[web2py] DAL Keys

2012-09-23 Thread Hassan Alnatour
Dear ALL , 

i am getting  this error 
'DAL' object has no attribute 'keys'

when using this code :

for table in db.keys():
  if not (table.startswith('_') or table in badmin_tables):
if db[table] and not table in badmin_exclude_tables:
  if isinstance(db[table],db.Table):
  if table == "auth_user" :
badmin_tables[table]={
  #'columns':db[table].fields[:3],
  'columns':['first_name','last_name','Country','Age','email'],
  'filters':['first_name','Country','Age'],
}
  else:
  
badmin_tables[table]={
  'columns':db[table].fields[:3],
  'filters':[],
}


whey cant i use db.keys now ? how can i fix this 

Best Regards,

-- 





Re: [web2py] Superfish in Web2py 2.0

2012-09-23 Thread Richard Vézina
I don't know, you can look at bootstrap css class name on bootstrap site, I
presume that nav is a bootstrap classes name, so they use it if they want a
bootstrap styling into web2py...

Richard

On Sat, Sep 22, 2012 at 10:39 AM, Patrick Ryan  wrote:

> Thanks Richard. That's very helpful. I'm looking to use the MENU helper to
> build a custom sidebar menu so all I need to do now is isolate and modify
> the js and css. Is nav now the default class id for the helper?
>
>
> On Saturday, September 22, 2012, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
> > It works with Bootstrap now as far as I can see, there is a piece of js
> in the layout to allow bootstrap menu to have the same behavior of
> superfish (I mean submenu, subsubmenu, etc.). I try my app in the under new
> web2py 2.0.X version and I didn't have to make any change to my MENU()
> stuff.
> > When you migrate, take care to remplace your old layout by the new one
> (don't forget make backup :) or you can just grad what is required from the
> new layout and bring it into you own customized one. You have also to
> update generic view, web2py_ajax, web2py.js, jquery.js and many other
> files. Also, appadmin.py controller has to be update.
> > Hopes it help!
> > Richard
> >
> > On Fri, Sep 21, 2012 at 9:55 PM, pjryan126  wrote:
> >>
> >> Hi, I'm working on a custom menu, and I noticed there is no longer a
> superfish.css file in the scaffolding app, though the file is still in the
> examples application. Has superfish been replaced with something new in
> Web2py 2.0 , and if so, what is the new default _class for the MENU()
> helper? I'm not well acquainted with css, so any info would be extremely
> appreciated!
> >> Thanks,
> >> Patrick
> >>
> >> --
> >>
> >>
> >>
> >
> > --
> >
> >
> >
> >
>
> --
>
>
>
>

-- 





Re: [web2py] DAL Keys

2012-09-23 Thread Carlos Correia
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi,

You should use db.tables instead:

for table in db.tables:
  (...)

Em 23-09-2012 12:56, Hassan Alnatour escreveu:
> Dear ALL , 
> 
> i am getting  this error 
> 
> 
> 'DAL' object has no attribute 'keys'
> 
> 
> when using this code :
> 
> for table in db.keys():
>   if not (table.startswith('_') or table in badmin_tables):
> if db[table] and not table in badmin_exclude_tables:
>   if isinstance(db[table],db.Table):
>   if table == "auth_user" :
> badmin_tables[table]={
>   #'columns':db[table].fields[:3],
>   'columns':['first_name','last_name','Country','Age','email'],
>   'filters':['first_name','Country','Age'],
> }
>   else:
>   
> badmin_tables[table]={
>   'columns':db[table].fields[:3],
>   'filters':[],
> }
> 
> 
> whey cant i use db.keys now ? how can i fix this 
> 
> Best Regards,
> 
> -- 
>  
>  
>  


- -- 
Com os melhores cumprimentos,

Carlos Correia
=
MEMÓRIA PERSISTENTE
Tel.: 219 291 591 - GSM:  917 157 146 / 967 511 762
e-mail: ge...@memoriapersistente.pt - URL: http://www.memoriapersistente.pt
Jabber: m...@jabber.org
GnuPG: wwwkeys.eu.pgp.net
URL Suporte: https://ky.m16e.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iEYEARECAAYFAlBfFQUACgkQ90uzwjA1SJV2MgCgsDp8Lc1OFdQnmadf9ujPwPsc
CTAAoNf60JBOaz2SKnkLUQFj3R9kbPsc
=Z4bK
-END PGP SIGNATURE-

-- 





Re: [web2py] Invalid Syntax Error with HTML Helper attributes

2012-09-23 Thread Jonathan Lundell
On 23 Sep 2012, at 7:45 AM, Michael Wolfe  
wrote:
> I'm receiving an invalid syntax error when running from Windows.  I do not 
> receive the error when running the same code from my Webfaction account on 
> CentOS.  The error appears to be related to compiling of the code.  I assume 
> the compile code is taking issue with the HTML helper functions which allow 
> _myattribute="Value" to be translated into the HTML myattribute="Value".  Am 
> I just missing something simple?  This has been driving me crazy.  

That's pretty weird. I don't see a syntax error. Could you post your forms.py 
(preferably all of it, or at least through the function containing the error)?

> Thanks,
> Mike
> Traceback (most recent call last):
> 
>   File "M:\My Documents\EstateCommander\web2py\gluon\restricted.py", line 
> 208, in restricted
> 
> ccode = compile2(code,layer)
>   File "M:\My Documents\EstateCommander\web2py\gluon\restricted.py", line 
> 193, in compile2
> 
> return compile(code.rstrip().replace('\r\n','\n')+'\n', layer, 'exec')
> 
>   File "C:/Users/Mike/Documents/My 
> Dropbox/EstateCommander/web2py/applications/estate/controllers/forms.py", 
> line 15
> 
> table = TABLE(*rows, _border="0", _align="center", _width="50%")
> 
>^
> SyntaxError: invalid syntax
> 
> 


-- 





Re: [web2py] Re: New Plugin to add client side validation to your SQLFORM

2012-09-23 Thread Franco Alarcon
If you need some help, i'm glad to help you.

2012/9/22 Massimo Di Pierro 

> This is really a good idea. I will try it asap. Join us on
> web2py-developers.
>
>
> On Tuesday, 24 July 2012 09:38:51 UTC-5, Franco wrote:
>>
>>
>> 
>>
>> Greetings everyone. I want to share with you this plugin, it's based on
>> jquery-validation-engine plugin.
>>
>> It's easy to use, your only need to replace SQLFORM with JsSQLFORM and
>> that's it.
>>
>> At this moment only supports 7 validators (IS_NOT_EMPTY, IS_EMAIL, IS_**
>> URL, IS_DATE, IS_LENGTH, IS_**INT_IN_RANGE, IS_FLOAT_IN_**RANGE).
>>
>>
>> Here are some examples of use:
>> def validation():
>>
>>
>>
>> from plugin_ValidationEngine import JsSQLFORM
>>
>> f = JsSQLFORM.factory(
>>
>> Field('nombre', requires = [IS_NOT_EMPTY(), IS_LENGTH(20, 3)],label
>> = 'Nombre'),
>>
>> Field('apellido', requires = IS_NOT_EMPTY(), label = 'Apellido'),
>>
>> Field('cuit', requires = IS_LENGTH(12, 12), label = 'Cuit'),
>>
>> Field('edad', requires = IS_INT_IN_RANGE(18, 65), label = 'Edad'
>> ),
>>
>> Field('importe', requires = IS_FLOAT_IN_RANGE(1, .99), label
>> = 'Importe')
>>
>> )
>>
>> if f.accepts(request, session):
>>
>> response.flash = 'Ok'
>>
>> else:
>>
>> response.flash = 'Bad'
>>
>> return dict(form = f)
>>
>>
>>
>>
>> def validation2():
>>
>> from plugin_ValidationEngine import JsSQLFORM
>>
>> f = JsSQLFORM(db.test)
>>
>> if f.accepts(request, session):
>>
>> response.flash = 'Ok'
>>
>> else:
>>
>> response.flash = 'Bad'
>>
>> return dict(form = f)
>>
>>
>>
>>
>>
>>
>>
>>  --
>
>
>
>



-- 
*Franco Andrés Alarcón*

-- 





Re: [web2py] Re: New Plugin to add client side validation to your SQLFORM

2012-09-23 Thread Richard Vézina
Thanks Franco for this seems really interresting...

I was planning to look into client side validation, now I hope it could get
include into web2py with clientvalidation=True

:)

Richard

On Sun, Sep 23, 2012 at 11:41 AM, Franco Alarcon
wrote:

> If you need some help, i'm glad to help you.
>
>
> 2012/9/22 Massimo Di Pierro 
>
>> This is really a good idea. I will try it asap. Join us on
>> web2py-developers.
>>
>>
>> On Tuesday, 24 July 2012 09:38:51 UTC-5, Franco wrote:
>>>
>>>
>>> 
>>>
>>> Greetings everyone. I want to share with you this plugin, it's based on
>>> jquery-validation-engine plugin.
>>>
>>> It's easy to use, your only need to replace SQLFORM with JsSQLFORM and
>>> that's it.
>>>
>>> At this moment only supports 7 validators (IS_NOT_EMPTY, IS_EMAIL, IS_**
>>> URL, IS_DATE, IS_LENGTH, IS_**INT_IN_RANGE, IS_FLOAT_IN_**RANGE).
>>>
>>>
>>> Here are some examples of use:
>>> def validation():
>>>
>>>
>>>
>>> from plugin_ValidationEngine import JsSQLFORM
>>>
>>> f = JsSQLFORM.factory(
>>>
>>> Field('nombre', requires = [IS_NOT_EMPTY(), IS_LENGTH(20, 3)],label
>>> = 'Nombre'),
>>>
>>> Field('apellido', requires = IS_NOT_EMPTY(), label = 'Apellido'
>>> ),
>>>
>>> Field('cuit', requires = IS_LENGTH(12, 12), label = 'Cuit'),
>>>
>>> Field('edad', requires = IS_INT_IN_RANGE(18, 65), label = 'Edad'
>>> ),
>>>
>>> Field('importe', requires = IS_FLOAT_IN_RANGE(1, .99),label
>>> = 'Importe')
>>>
>>> )
>>>
>>> if f.accepts(request, session):
>>>
>>> response.flash = 'Ok'
>>>
>>> else:
>>>
>>> response.flash = 'Bad'
>>>
>>> return dict(form = f)
>>>
>>>
>>>
>>>
>>> def validation2():
>>>
>>> from plugin_ValidationEngine import JsSQLFORM
>>>
>>> f = JsSQLFORM(db.test)
>>>
>>> if f.accepts(request, session):
>>>
>>> response.flash = 'Ok'
>>>
>>> else:
>>>
>>> response.flash = 'Bad'
>>>
>>> return dict(form = f)
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>  --
>>
>>
>>
>>
>
>
>
> --
> *Franco Andrés Alarcón*
>
>  --
>
>
>
>

-- 





[web2py] System cannot find path specified

2012-09-23 Thread Bill Thayer
I am writing a parser to populate my database. when I used xmlprpxlib I got 
a malformed xml error. In reading the book it looked like simplejsonrpc was 
similar so figured I'd give it a shot and wrote a simple test script.

# -*- coding: cp1252 -*-
import os, sys
print sys.path
from xmlrpclib import ServerProxy
from gluon.contrib.simplejsonrpc import ServerProxy

jserver = ServerProxy('http://127.0.0.1:8000/TAMOTO_2012/core/call/xmlrpc')
jserver = 
ServerProxy('http://127.0.0.1:8000/TAMOTO_2012/core/call/jsonrpc',verbose
=True)
#using the example from the book to test that the call works
print server.add(3,4) 

#
print jserver.add_process("VPIN", "0.25-µm Verticle Pin Diode 2MI", 0.25, 1, 
1, "Test import process from xmlrpc call.")

print xserver.add_process("VPIN", "0.25-µm Verticle Pin Diode 2MI", 0.25, 1, 
1, "Test import process from xmlrpc call.")




BTW. Looks like the example in the book has an incomplete import statement 
since the Idle editor tells me so. I changed 

from gluon.contrib.simplejsonrpc import


to
from gluon.contrib.simplejsonrpc import ServerProxy

I added c:\web2py to PYTHONPATH and restarted the Idle editor and confirmed 
c:web2py in the path browser. 
It is further confirmed in the output from
print sys.path

my file is in C:\web2py\applications\TAMOTO_2012\private if that is relavant.
This error message occurs from the simplejsonrpc:
>>> 
['C:\\web2py\\applications\\TAMOTO_2012\\private', 
'C:\\Python27\\Lib\\idlelib', 
'C:\\Python27\\lib\\site-packages\\setuptools-0.6c11-py2.7.egg', 
'C:\\Python27\\lib\\site-packages\\generateds-2.6a-py2.7.egg', 'C:\\Python27', 
'C:\\web2py', 'C:\\Windows\\system32\\python27.zip', 'C:\\Python27\\DLLs', 
'C:\\Python27\\lib', 'C:\\Python27\\lib\\plat-win', 
'C:\\Python27\\lib\\lib-tk', 'C:\\Python27\\lib\\site-packages', 
'C:\\Python27\\lib\\site-packages\\win32', 
'C:\\Python27\\lib\\site-packages\\win32\\lib', 
'C:\\Python27\\lib\\site-packages\\Pythonwin']
No handlers could be found for logger "web2py"

Traceback (most recent call last):
 File "C:\web2py\gluon\__init__.py", line 15, in 
 from globals import current
 File "C:\web2py\gluon\globals.py", line 24, in 
 from serializers import json, custom_json
 File "C:\web2py\gluon\serializers.py", line 11, in 
 from languages import lazyT
 File "C:\web2py\gluon\languages.py", line 264, in 
 PLURAL_RULES = read_possible_plurals()
 File "C:\web2py\gluon\languages.py", line 250, in read_possible_plurals
 for pname in os.listdir(pdir):
WindowsError: [Error 3] The system cannot find the path specified: 
'C:\\web2py\\applications\\TAMOTO_2012\\private\\gluon\\contrib\\rules/*.*'



Been working on this all morning. Any help is apreciated.

-- 





[web2py] Re: (2.0.9) compute fields don't work on db update

2012-09-23 Thread Alan Etkin
El sábado, 22 de septiembre de 2012 22:36:44 UTC-3, VP escribió:
>
> I figured out what I would call a bug.


I'm not sure it's a bug. It would if, for example, the documentation said 
it's possible to do field calculations without passing all the involved 
parameters. I belive this is not the case. I've tested the .update_record 
method with trunk and it updates just the provided fields, leaving 
calculated field as before when there are not enough parameters to update 
it. Yet, I agree that it would be better to handle this updates even 
without the required data automatically, as an enhancement.
 

-- 





[web2py] Re: Using the template system to generate messages

2012-09-23 Thread Pystar
Using this method, the mail is sent successfully,but shows raw html code in 
the email client, i.e. its not rendering


On Friday, September 7, 2012 4:19:45 PM UTC+1, Niphlod wrote:
>
> it's a path relative to the app's *views *folder. With this code your *
> message.html* should be next to layout.html, just in the 
> *yourapp/views/*folder.
>
> Il giorno venerdì 7 settembre 2012 17:04:27 UTC+2, Daniel Gonzalez ha 
> scritto:
>>
>> As explained here:
>>
>>
>> http://web2py.com/books/default/chapter/29/8#Using-the-template-system-to-generate-messages
>>
>> The following code can be used to render a view file to send via email:
>>
>> for person in db(db.person).select():
>> context = dict(person=person)
>> message = response.render('message.html', context)
>> mail.send(to=['w...@example.com'],
>>   subject='None',
>>   message=message)
>>
>> I have tried this, but I am not able to place the "message.html" 
>> correctly in the directory hierarchy.
>> How does reponse.render find the view files, or, even better, how can I 
>> tell response.render where to find my template file?
>>
>> Thanks,
>> Daniel
>>
>

-- 





Re: [web2py] Neither suggestion worked...

2012-09-23 Thread Bill Thayer
Hi Richard,

Sorry for not getting back to this right away. Had so much to do on this 
project this problem was burning valuable time. My first early release is 
this Thursday. From before, I did post the code exactly. I'll probably try 
your shell commands after 
Friday. Then I'll keep you posted.

Best Regards,
Bill

On Tuesday, August 28, 2012 9:24:09 AM UTC-5, Richard wrote:
>
> To see what the set return :
>
> print db((~db.trainer.id.belongs(db()._select(db.dogs.trainer
>
> When you will be into the web2py shell.
>
> Richard
>
> On Tue, Aug 28, 2012 at 10:22 AM, Richard Vézina 
> 
> > wrote:
>
>> Hi Bill,
>>
>> Did you try you set into the web2py shell to see if it returns something?
>>
>> I usually try my query in a terminal web2py shell to make sure my query 
>> are good before waisting time in navigator reloading page.
>>
>> Here how you can start a web2py shell :
>>
>> cd into the web2py folder 
>>
>> Than :
>>
>> python web2py.py -a 'tempory_pwd' -i 127.0.0.1 -p 8001 -S appname -M auto
>>
>> Under linux... It should be similar under windows.
>>
>> Richard
>>
>>
>> On Mon, Aug 27, 2012 at 9:57 PM, Bill Thayer 
>> > wrote:
>>
>>> ...no trainers are being returned. I even tried moving
>>> unassignedtrainers = (~db.trainer.id.belongs(db()._select(db.dogs.
>>> trainer)))
>>> db.dogs.trainer.requires = IS_IN_DB(db(unassignedtrainers), 'trainer.id'
>>> , '%(name)s',zero=T('choose one'))
>>>
>>>
>>> to the controller. No luck. 
>>>
>>> The drop down boxes do not appear,
>>> If I click the edit link there are no trainers to select.
>>>
>>> Tried Richards line to get the trainers without dogs as well.
>>>  
>>> Am I making this harder than it has to be?
>>>
>>> On Monday, August 27, 2012 2:49:22 PM UTC-5, Bill Thayer wrote:

 Thank you Richard,

 I'll try it as soon as I finish my current round of debugging.

 -Bill

 On Monday, August 27, 2012 1:20:49 PM UTC-5, Richard wrote:
>
> Hello,
>
> If I resume correctly you want to assign a trainer to a dog only if 
> the trainer haven't been assign to any dogs yet?
>
> So, what you have to do it to build a set instead of only define an 
> simple IS_IN_DB()...
>
> I would do something like this (not tested) :
>
> not_assign_yet_trainer_set = db(~db.trainers.id.belongs(**db(
> db.dogs.id>0).select(db.**dogs.trainer, distinct=True)))
>
> Than you only have to use your set instead of db.trainers in the 
> IS_IN_DB() where you normally define the db table to use.
>
> Does it help?
>
> Richard
>
> On Mon, Aug 27, 2012 at 1:12 PM, Bill Thayer wrote:
>
>> Tryin to use the example shown in Validators between classical and 
>> professional 
>> usageto change 
>> the values and widget for an SQLFORM.grid.
>>
>> I need to display an "Assign Trainers" page with an SQLFORM.grid (or 
>> something similar) of new dogs that have not been assigned to a trainer 
>> but 
>> can only be assigned to new trainers that have not been given dogs. So I 
>> thought simple query the is_active property on both cases, append the 
>> validator make (& process) my form. 
>>
>> db.define_table('trainer',
>> Field('name'),
>> Field('specialty'),
>> auth.signature,
>> format='%(name)s')
>> db.trainer.is_active.default=F**alse
>>
>> db.define_table('dogs',
>> Field('name'),
>> Field('bites', 'boolean'),
>> Field('trainer', 'reference trainer', 
>>   default=1,
>>   widget=SQLFORM.widgets.options**.widget,
>>   requires=[IS_IN_DB('db.**trainer', 
>>   IS_UPPER())]),
>> auth.signature,
>> migrate=True)
>>
>> db.dogs.is_active.default=Fals**e
>>
>> Controller:
>> def assign_trainers():
>> trainers=db(db.trianer._is_**active==False)
>> new_dogs=db(db.dogs._is_active**==False)
>> new_dogs.trainer.requires.appe**nd(IS_IN_SET(trainers))
>> 
>> grid = SQLFORM.grid(new_dogs)
>> 
>> return locals()
>>
>> Been working on this solution for two days now. Read all the books, 
>> bought the 
>> Cookbookread
>>  the blogs and now I'm out of time with my prototype presentation due 
>> Thursday.
>>
>> ANY help is very much needed at this point.
>>
>> Thank you,
>> Bill
>>
>>
>>
>>
>>  -- 
>>  
>>  
>>  
>>
>
>  -- 
>>>  
>>>  
>>>  
>>>
>>
>>
>

-- 





Re: [web2py] Re: Using the template system to generate messages

2012-09-23 Thread Marin Pranjić
Your email should begin with  tag and end with .
If you have anything before/after, it will not render.

Marin

On Sun, Sep 23, 2012 at 9:05 PM, Pystar  wrote:

> Using this method, the mail is sent successfully,but shows raw html code
> in the email client, i.e. its not rendering
>
>
> On Friday, September 7, 2012 4:19:45 PM UTC+1, Niphlod wrote:
>>
>> it's a path relative to the app's *views *folder. With this code your *
>> message.html* should be next to layout.html, just in the 
>> *yourapp/views/*folder.
>>
>> Il giorno venerdì 7 settembre 2012 17:04:27 UTC+2, Daniel Gonzalez ha
>> scritto:
>>>
>>> As explained here:
>>>
>>> http://web2py.com/books/**default/chapter/29/8#Using-**
>>> the-template-system-to-**generate-messages
>>>
>>> The following code can be used to render a view file to send via email:
>>>
>>> for person in db(db.person).select():
>>> context = dict(person=person)
>>> message = response.render('message.html'**, context)
>>> mail.send(to=['w...@example.**com'],
>>>   subject='None',
>>>   message=message)
>>>
>>> I have tried this, but I am not able to place the "message.html"
>>> correctly in the directory hierarchy.
>>> How does reponse.render find the view files, or, even better, how can I
>>> tell response.render where to find my template file?
>>>
>>> Thanks,
>>> Daniel
>>>
>>  --
>
>
>
>

-- 





[web2py] Re: Using the template system to generate messages

2012-09-23 Thread Pystar
Ok, I solved it. The trick is that message is first text, then html. So the 
signature should read like this:

context = dict(x=y)
message = response.render("message.html", context)
***Please note that the message.html file should be in the top level of 
your views folder or should be a absolute path to it.

mail.send(to=[recipient],subject='subject',message=message) 

will result in a text message. 

to render as html, is :

mail.send(to=[recipient],subject='subject',message=[None,message]) 

On Sunday, September 23, 2012 8:05:24 PM UTC+1, Pystar wrote:
>
> Using this method, the mail is sent successfully,but shows raw html code 
> in the email client, i.e. its not rendering
>
>
> On Friday, September 7, 2012 4:19:45 PM UTC+1, Niphlod wrote:
>>
>> it's a path relative to the app's *views *folder. With this code your *
>> message.html* should be next to layout.html, just in the 
>> *yourapp/views/*folder.
>>
>> Il giorno venerdì 7 settembre 2012 17:04:27 UTC+2, Daniel Gonzalez ha 
>> scritto:
>>>
>>> As explained here:
>>>
>>>
>>> http://web2py.com/books/default/chapter/29/8#Using-the-template-system-to-generate-messages
>>>
>>> The following code can be used to render a view file to send via email:
>>>
>>> for person in db(db.person).select():
>>> context = dict(person=person)
>>> message = response.render('message.html', context)
>>> mail.send(to=['w...@example.com'],
>>>   subject='None',
>>>   message=message)
>>>
>>> I have tried this, but I am not able to place the "message.html" 
>>> correctly in the directory hierarchy.
>>> How does reponse.render find the view files, or, even better, how can I 
>>> tell response.render where to find my template file?
>>>
>>> Thanks,
>>> Daniel
>>>
>>

-- 





[web2py] Re: System cannot find path specified

2012-09-23 Thread Bill Thayer
Just noticed a typo (first jserver should be xserver) but it doesn't affect 
the outcome.

On Sunday, September 23, 2012 1:32:40 PM UTC-5, Bill Thayer wrote:
>
> I am writing a parser to populate my database. when I used xmlprpxlib I 
> got a malformed xml error. In reading the book it looked like simplejsonrpc 
> was similar so figured I'd give it a shot and wrote a simple test script.
>
> # -*- coding: cp1252 -*-
> import os, sys
> print sys.path
> from xmlrpclib import ServerProxy
> from gluon.contrib.simplejsonrpc import ServerProxy
>
> xserver = ServerProxy('http://127.0.0.1:8000/TAMOTO_2012/core/call/xmlrpc'
> )
> jserver = ServerProxy('http://127.0.0.1:8000/TAMOTO_2012/core/call/jsonrpc
> ', verbose=True)
> #using the example from the book to test that the call works
> print server.add(3,4) 
>
> #
> print jserver.add_process("VPIN", "0.25-µm Verticle Pin Diode 2MI", 0.25, 
> 1, 1, "Test import process from xmlrpc call.")
>
> print xserver.add_process("VPIN", "0.25-µm Verticle Pin Diode 2MI", 0.25, 
> 1, 1, "Test import process from xmlrpc call.")
>
>
>
>
> BTW. Looks like the example in the book has an incomplete import statement 
> since the Idle editor tells me so. I changed 
>
> from gluon.contrib.simplejsonrpc import
>
>
> to
> from gluon.contrib.simplejsonrpc import ServerProxy
>
> I added c:\web2py to PYTHONPATH and restarted the Idle editor and confirmed 
> c:web2py in the path browser. 
> It is further confirmed in the output from
> print sys.path
>
> my file is in C:\web2py\applications\TAMOTO_2012\private if that is relavant.
> This error message occurs from the simplejsonrpc:
> >>> 
> ['C:\\web2py\\applications\\TAMOTO_2012\\private', 
> 'C:\\Python27\\Lib\\idlelib', 
> 'C:\\Python27\\lib\\site-packages\\setuptools-0.6c11-py2.7.egg', 
> 'C:\\Python27\\lib\\site-packages\\generateds-2.6a-py2.7.egg', 
> 'C:\\Python27', 'C:\\web2py', 'C:\\Windows\\system32\\python27.zip', 
> 'C:\\Python27\\DLLs', 'C:\\Python27\\lib', 'C:\\Python27\\lib\\plat-win', 
> 'C:\\Python27\\lib\\lib-tk', 'C:\\Python27\\lib\\site-packages', 
> 'C:\\Python27\\lib\\site-packages\\win32', 
> 'C:\\Python27\\lib\\site-packages\\win32\\lib', 
> 'C:\\Python27\\lib\\site-packages\\Pythonwin']
> No handlers could be found for logger "web2py"
>
> Traceback (most recent call last):
>  File "C:\web2py\gluon\__init__.py", line 15, in 
>  from globals import current
>  File "C:\web2py\gluon\globals.py", line 24, in 
>  from serializers import json, custom_json
>  File "C:\web2py\gluon\serializers.py", line 11, in 
>  from languages import lazyT
>  File "C:\web2py\gluon\languages.py", line 264, in 
>  PLURAL_RULES = read_possible_plurals()
>  File "C:\web2py\gluon\languages.py", line 250, in read_possible_plurals
>  for pname in os.listdir(pdir):
> WindowsError: [Error 3] The system cannot find the path specified: 
> 'C:\\web2py\\applications\\TAMOTO_2012\\private\\gluon\\contrib\\rules/*.*'
>
>
>
> Been working on this all morning. Any help is apreciated.
>
>

-- 





[web2py] Re: (2.0.9) compute fields don't work on db update

2012-09-23 Thread Niphlod
Sidenote: the current behaviour allows everyone to have e.g. a heavy lambda 
attached to a field and fire that one only when needed. If your lambda 
needs both values, you should update the record specifying both values 
everywhere.
Disclaimer: I'm "a db man" hence not a big fan of computed fields - I 
prefer triggers on the db. Even when triggers where not available in web2py 
(and I couldn't write triggers directly on the db), I wrote small functions 
to help on this kind of things. Now that "triggers" are available on 
web2py, this kind of "situation" can be easily addressed (and a lot better) 
with those.

-- 





[web2py] sending emails on gae doesnt work

2012-09-23 Thread Pystar
sending emails on gae doesnt work although it works perfectly on localhost.
I am using "gae" as settings

-- 





[web2py] rocket.error

2012-09-23 Thread Martin Weissenboeck
I have got the following error message.
This message appeard a short time after I had sent something using the
"mail.send" function.

ERROR:Rocket.Errors.Thread-10:Traceback (most recent call last):

  File "D:\dropbox\InfoSMS\web2py\gluon\rocket.py", line 1302, in run
self.run_app(conn)

  File "D:\dropbox\InfoSMS\web2py\gluon\rocket.py", line 2016, in run_app
self.write(data, sections)

  File "D:\dropbox\InfoSMS\web2py\gluon\rocket.py", line 1933, in write
self.send_headers(data, sections)

  File "D:\dropbox\InfoSMS\web2py\gluon\rocket.py", line 1885, in
send_headers
h_set['Content-Length'] = str(len(data))

TypeError: object of type 'int' has no len()

Regards, Martin

-- 





[web2py] Re: smartgrid: linked_tables=dict(parent=['child'], child=[''])

2012-09-23 Thread Massimo Di Pierro
I just added the syntax you requested:

linked_tables=dict(parent=['child'], child=[])

Please help me test it.


On Saturday, 22 September 2012 18:55:57 UTC-5, Adi wrote:
>
> If I may rephrase and clarify a question: 
>
> Is it possible to add control, through dictionary in (smartgrid) 
> linked_tables when will links display?
>
> e.g: linked_tables=dict(parent=['child'], child=[''])
>
> wishful outcome: display children links for parent table, but don't 
> display any related links for child table.
>
> Thanks,
> Adnan
>
>
> On Friday, September 21, 2012 11:58:05 AM UTC-4, Adi wrote:
>>
>> I'm wondering what to do in this situation? I have self-referencing 
>> fields in the child table, and due to that smartgrid display links, which 
>> basically can't do anything. 
>>
>> I'm trying to eliminate them, but not sure what would be a proper way? 
>>
>> Thanks.
>>
>> Simplified code sample: 
>> db.define_table('campaign',
>> Field('tbl_uuid', length=64, default=lambda:str(uuid.
>> uuid4())),
>> Field('name','string', label=T('Campaing Name')),
>> format='%(name)s',
>> )
>>
>> db.define_table('message',
>> Field('tbl_uuid', length=64, default=lambda:str(uuid.
>> uuid4())),
>> Field('name','string', label=T('Name')),
>> Field('campaign_id', 'reference campaign', label=T(
>> 'Campaign')),
>> Field('action_yes_id', 'reference message)', 
>> label=T('Action 
>> Yes'),),
>> Field('action_no_id', 'reference message)', 
>> label=T('Action 
>> No')),
>> migrate=True)
>>
>>
>>
>> grid=SQLFORM.smartgrid(Campaign, details=False, links_in_grid=True,
>> linked_tables=['message'],
>> #linked_tables=dict(campaign=['message'], 
>> message=['']),
>> links=dict(campaign=[lambda row:(_get_messages(row))
>> ]),
>> )
>> Enter code here...
>>
>>
>>

-- 





[web2py] Re: how to make autocomplete widget show arbitrary values in the list

2012-09-23 Thread Massimo Di Pierro
The autocomplete cannot use format to represent a field but if you store 
the representation in an computed field, you can use that for autocomplete.

On Saturday, 22 September 2012 22:23:51 UTC-5, alex wrote:
>
> Hi all, 
>
>  
>
> How to solve this:
>
>  
>
> There are two tables, table "xref" has two fields with a reference to 
> table "table". Look at the format of “table”.
>
>  
>
> db.define_table('table',
>
> Field('name', type='string'),
>
> Field('number', type='integer'),
>
> auth.signature,
>
> *format*= lambda row: str(row.number) + ' (' +row.name + ')',   ## @1
>
> migrate=settings.migrate)
>
>  
>
> db.define_table('xref',
>
> Field('t1_ref', type='reference table',
>
> widget = 
> SQLFORM.widgets.autocomplete(request, db.table.id, id_field=db.table.id)),
>
> Field('t2_ref', type='reference table',
>
> widget = 
> SQLFORM.widgets.autocomplete(request, db.table.id, id_field=db.table.id)),
>
> auth.signature,
>
> migrate=settings.migrate)
>
> 
>
> Now if in the controller I define 
>
> form = crud.update(db.xref, record) to update one record 
> in xref, or 
>
> form = crud.create(db.xref) to create a new record in xref 
>
>  
>
> the autocomplete widget always returns the ids of the table "table", not 
> the required format (see @1).
>
>  
>
> The required format is shown correctly only with crud.read, or when in 
> crud.update the property writabe of the field is set to False, 
>
> for example as below:
>
>  
>
> def edit():
>
> record = db.xref(request.args(0))
>
> form = crud.update(db.xref, record)
>
> db.xref.t1_ref.writable = False
>
> return dict(form=form)
>
>  
>
> In this case the field t1_ref is represented correctly (as @1), the field 
> t2_ref shows an autocomplete widget with only ids of table.
>
>  
>
> How to make that the autcomplete widget shows always a list formatted as 
> in @1, and not just the ids of the referenced table?
>

-- 





[web2py] Re: System cannot find path specified

2012-09-23 Thread Massimo Di Pierro
The problem is that c:/web2py should be the first item in PYTHONPATH. Do 
you insert stuff in sys.path in your code?


On Sunday, 23 September 2012 13:32:40 UTC-5, Bill Thayer wrote:
>
> I am writing a parser to populate my database. when I used xmlprpxlib I 
> got a malformed xml error. In reading the book it looked like simplejsonrpc 
> was similar so figured I'd give it a shot and wrote a simple test script.
>
> # -*- coding: cp1252 -*-
> import os, sys
> print sys.path
> from xmlrpclib import ServerProxy
> from gluon.contrib.simplejsonrpc import ServerProxy
>
> jserver = ServerProxy('http://127.0.0.1:8000/TAMOTO_2012/core/call/xmlrpc'
> )
> jserver = ServerProxy('http://127.0.0.1:8000/TAMOTO_2012/core/call/jsonrpc
> ', verbose=True)
> #using the example from the book to test that the call works
> print server.add(3,4) 
>
> #
> print jserver.add_process("VPIN", "0.25-µm Verticle Pin Diode 2MI", 0.25, 
> 1, 1, "Test import process from xmlrpc call.")
>
> print xserver.add_process("VPIN", "0.25-µm Verticle Pin Diode 2MI", 0.25, 
> 1, 1, "Test import process from xmlrpc call.")
>
>
>
>
> BTW. Looks like the example in the book has an incomplete import statement 
> since the Idle editor tells me so. I changed 
>
> from gluon.contrib.simplejsonrpc import
>
>
> to
> from gluon.contrib.simplejsonrpc import ServerProxy
>
> I added c:\web2py to PYTHONPATH and restarted the Idle editor and confirmed 
> c:web2py in the path browser. 
> It is further confirmed in the output from
> print sys.path
>
> my file is in C:\web2py\applications\TAMOTO_2012\private if that is relavant.
> This error message occurs from the simplejsonrpc:
> >>> 
> ['C:\\web2py\\applications\\TAMOTO_2012\\private', 
> 'C:\\Python27\\Lib\\idlelib', 
> 'C:\\Python27\\lib\\site-packages\\setuptools-0.6c11-py2.7.egg', 
> 'C:\\Python27\\lib\\site-packages\\generateds-2.6a-py2.7.egg', 
> 'C:\\Python27', 'C:\\web2py', 'C:\\Windows\\system32\\python27.zip', 
> 'C:\\Python27\\DLLs', 'C:\\Python27\\lib', 'C:\\Python27\\lib\\plat-win', 
> 'C:\\Python27\\lib\\lib-tk', 'C:\\Python27\\lib\\site-packages', 
> 'C:\\Python27\\lib\\site-packages\\win32', 
> 'C:\\Python27\\lib\\site-packages\\win32\\lib', 
> 'C:\\Python27\\lib\\site-packages\\Pythonwin']
> No handlers could be found for logger "web2py"
>
> Traceback (most recent call last):
>  File "C:\web2py\gluon\__init__.py", line 15, in 
>  from globals import current
>  File "C:\web2py\gluon\globals.py", line 24, in 
>  from serializers import json, custom_json
>  File "C:\web2py\gluon\serializers.py", line 11, in 
>  from languages import lazyT
>  File "C:\web2py\gluon\languages.py", line 264, in 
>  PLURAL_RULES = read_possible_plurals()
>  File "C:\web2py\gluon\languages.py", line 250, in read_possible_plurals
>  for pname in os.listdir(pdir):
> WindowsError: [Error 3] The system cannot find the path specified: 
> 'C:\\web2py\\applications\\TAMOTO_2012\\private\\gluon\\contrib\\rules/*.*'
>
>
>
> Been working on this all morning. Any help is apreciated.
>
>

-- 





[web2py] Re: (2.0.9) compute fields don't work on db update

2012-09-23 Thread Massimo Di Pierro
What version are you using?

This is what I get:

>>> db=DAL()
>>> product = db.define_table('product', Field('cost1'), Field('cost2'), 
Field('total', compute = lambda r: r['cost1'] + r['cost2']))
>>> product.insert(cost1=10, cost2=20)
1
>>> p = db.product(1)
>>> p.update_record(cost1=5)
, 
'cost1': 5, 'cost2': '20', 'total': '30', 'id': 1, 'delete_record': 
}>
>>> print db.product[1].total
30

On Saturday, 22 September 2012 20:36:44 UTC-5, VP wrote:
>
> I figured out what I would call a bug.
>
> I'll give an example:
>
> Let's say we have this table:
>
>
> product = db.define_table('product', Field('cost1'), Field('cost2'), 
> Field('total', compute = lambda r: r['cost1'] + r['cost2']))
>
>
> And if you do this:
>
> product.insert(cost1=10, cost2=20)
> p = db.product(1)
> p.update_record(cost1=5)
>
>
> This update won't work.  What is worse is that it fails silently.   The 
> reason it won't work is that the row input of the lambda does not have 
> "cost2" in it.
>
> If, however, you do this:
>
> p.update_record(cost1=5, cost2=p.cost2)
>
> Then it will work, because now the parameter r (i.e. the row) has both 
> cost1 and cost2.
>
>
>
> I think it'll be a little tricky for you to fix this, because you probably 
> want update to have only relevant fields so that saving to the database is 
> effective.   However, this behavior clearly is not desirable.
>
>
>
> On Saturday, September 22, 2012 5:23:43 PM UTC-5, Massimo Di Pierro wrote:
>>
>> Can you show us an example?
>>
>> computed fields usually do not work when there is not enough information 
>> to compute. The information must be in the arguments of update_record or 
>> update. It will not retrive the info from the database.
>>
>>
>>
>>
>> On Saturday, 22 September 2012 15:43:59 UTC-5, VP wrote:
>>>
>>> - sqlite
>>> - 2 compute fields do not seem to get call on update using both 
>>> update_record and db().update
>>> - They do work on crud/form updates though.
>>>
>>

-- 





[web2py] Re: sending emails on gae doesnt work

2012-09-23 Thread Massimo Di Pierro
Do you get an error?

On Sunday, 23 September 2012 16:10:35 UTC-5, Pystar wrote:
>
> sending emails on gae doesnt work although it works perfectly on localhost.
> I am using "gae" as settings
>

-- 





[web2py] Re: sending emails on gae doesnt work

2012-09-23 Thread Pystar
These are the settings:
auth.settings.register_onaccept = [messenger]

mail=auth.settings.mailer
mail.settings.server = 'gae'
mail.settings.sender = 'usern...@gmail.com'
mail.settings.login = 'username:password'

def messenger(form):
context = dict(uniqueid=form.vars.uniqueid, 
first_name=form.vars.first_name)
message = response.render("message.html", context)
mail.send(to=form.vars.email, subject="welcome to ICOP NIGERIA!", 
message=[None, message])

The surprising thing is that it works perfectly on localhost but fails 
silently on GAE.
I need help, its URGENT.

On Sunday, September 23, 2012 10:41:45 PM UTC+1, Massimo Di Pierro wrote:
>
> Do you get an error?
>
> On Sunday, 23 September 2012 16:10:35 UTC-5, Pystar wrote:
>>
>> sending emails on gae doesnt work although it works perfectly on 
>> localhost.
>> I am using "gae" as settings
>>
>

-- 





Re: [web2py] Re: smartgrid: linked_tables=dict(parent=['child'], child=[''])

2012-09-23 Thread Adnan Smajlovic
Thanks Massimo!

I'm trying to test it, but got this error bellow:

  File "/Users/adnan/web2py-trunk/gluon/sqlhtml.py", line 2280, in smartgrid
linked_tables = linked_tables.get(tablename,[])
UnboundLocalError: local variable 'tablename' referenced before assignment



On Sun, Sep 23, 2012 at 5:31 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> I just added the syntax you requested:
>
> linked_tables=dict(parent=['**child'], child=[])
>
> Please help me test it.
>
>
> On Saturday, 22 September 2012 18:55:57 UTC-5, Adi wrote:
>>
>> If I may rephrase and clarify a question:
>>
>> Is it possible to add control, through dictionary in (smartgrid)
>> linked_tables when will links display?
>>
>> e.g: linked_tables=dict(parent=['**child'], child=[''])
>>
>> wishful outcome: display children links for parent table, but don't
>> display any related links for child table.
>>
>> Thanks,
>> Adnan
>>
>>
>> On Friday, September 21, 2012 11:58:05 AM UTC-4, Adi wrote:
>>>
>>> I'm wondering what to do in this situation? I have self-referencing
>>> fields in the child table, and due to that smartgrid display links, which
>>> basically can't do anything.
>>>
>>> I'm trying to eliminate them, but not sure what would be a proper way?
>>>
>>> Thanks.
>>>
>>> Simplified code sample:
>>> db.define_table('campaign',
>>> Field('tbl_uuid', length=64, default=lambda:str(uuid
>>> .uuid4(**))),
>>> Field('name','string', label=T('Campaing Name')),
>>> format='%(name)s',
>>> )
>>>
>>> db.define_table('message',
>>> Field('tbl_uuid', length=64, default=lambda:str(uuid
>>> .uuid4(**))),
>>> Field('name','string', label=T('Name')),
>>> Field('campaign_id', 'reference campaign', label=T(
>>> 'Campaign')),
>>> Field('action_yes_id', 'reference message)', label=T
>>> ('Action Yes'),),
>>> Field('action_no_id', 'reference message)', 
>>> label=T('Action
>>> No')),
>>> migrate=True)
>>>
>>>
>>>
>>> grid=SQLFORM.smartgrid(Campaig**n, details=False, links_in_grid=True,
>>> linked_tables=['message'],
>>> #linked_tables=dict(campaign=[**'message'],
>>> message=['']),
>>> links=dict(campaign=[lambda row:(_get_messages(row))
>>> ]),
>>> )
>>> Enter code here...
>>>
>>>
>>>  --
>
>
>
>



-- 

Thanks,
Adnan

video: http://vimeo.com/24653283

-- 





[web2py] facebook comments

2012-09-23 Thread Jose
Hello

I am developed a website and want to include the facebook comment box.

I went to [1] and got the following code:

{{url = 
"http://www.my_domain.com%s/%s"%(request.url,request.env.query_string)}}   


(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/es_ES/all.js#xfbml=1";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));  
 


The comments work well, but the problem I have is that it shows the message:

Warning: http://www.my_domain.com/fpaa2/default/obra/6/ is unreachable.


debugging:

Errors That Must Be Fixed
> Missing Required Property: The 'og:url' property is required, but not 
> present.



I saw many people it happens. I followed some suggestions, but can not find 
solution

Any idea?

Jose


[1] http://developers.facebook.com/docs/reference/plugins/comments/

-- 





[web2py] Re: sending emails on gae doesnt work

2012-09-23 Thread howesc
did you check the GAE logs?  remember that GAE won't send emails unless the 
from address is at least a viewer of the GAE application.

please double check the GAE logs for warning messagesi think that is 
how google logs them.

cfh

On Sunday, September 23, 2012 3:35:16 PM UTC-7, Pystar wrote:
>
> These are the settings:
> auth.settings.register_onaccept = [messenger]
>
> mail=auth.settings.mailer
> mail.settings.server = 'gae'
> mail.settings.sender = 'user...@gmail.com '
> mail.settings.login = 'username:password'
>
> def messenger(form):
> context = dict(uniqueid=form.vars.uniqueid, 
> first_name=form.vars.first_name)
> message = response.render("message.html", context)
> mail.send(to=form.vars.email, subject="welcome to ICOP NIGERIA!", 
> message=[None, message])
>
> The surprising thing is that it works perfectly on localhost but fails 
> silently on GAE.
> I need help, its URGENT.
>
> On Sunday, September 23, 2012 10:41:45 PM UTC+1, Massimo Di Pierro wrote:
>>
>> Do you get an error?
>>
>> On Sunday, 23 September 2012 16:10:35 UTC-5, Pystar wrote:
>>>
>>> sending emails on gae doesnt work although it works perfectly on 
>>> localhost.
>>> I am using "gae" as settings
>>>
>>

-- 





[web2py] Re: sending emails on gae doesnt work

2012-09-23 Thread Pystar
The thing is that I can send ordinary text messages, but sending html 
messages fails.

On Monday, September 24, 2012 12:52:42 AM UTC+1, howesc wrote:
>
> did you check the GAE logs?  remember that GAE won't send emails unless 
> the from address is at least a viewer of the GAE application.
>
> please double check the GAE logs for warning messagesi think that is 
> how google logs them.
>
> cfh
>
> On Sunday, September 23, 2012 3:35:16 PM UTC-7, Pystar wrote:
>>
>> These are the settings:
>> auth.settings.register_onaccept = [messenger]
>>
>> mail=auth.settings.mailer
>> mail.settings.server = 'gae'
>> mail.settings.sender = 'user...@gmail.com'
>> mail.settings.login = 'username:password'
>>
>> def messenger(form):
>> context = dict(uniqueid=form.vars.uniqueid, 
>> first_name=form.vars.first_name)
>> message = response.render("message.html", context)
>> mail.send(to=form.vars.email, subject="welcome to ICOP NIGERIA!", 
>> message=[None, message])
>>
>> The surprising thing is that it works perfectly on localhost but fails 
>> silently on GAE.
>> I need help, its URGENT.
>>
>> On Sunday, September 23, 2012 10:41:45 PM UTC+1, Massimo Di Pierro wrote:
>>>
>>> Do you get an error?
>>>
>>> On Sunday, 23 September 2012 16:10:35 UTC-5, Pystar wrote:

 sending emails on gae doesnt work although it works perfectly on 
 localhost.
 I am using "gae" as settings

>>>

-- 





Re: [web2py] Re: smartgrid: linked_tables=dict(parent=['child'], child=[''])

2012-09-23 Thread Massimo Di Pierro
Can you please try again?

On Sunday, 23 September 2012 18:03:48 UTC-5, Adi wrote:
>
> Thanks Massimo!
>
> I'm trying to test it, but got this error bellow:
>
>   File "/Users/adnan/web2py-trunk/gluon/sqlhtml.py", line 2280, in smartgrid
>
> linked_tables = linked_tables.get(tablename,[])
> UnboundLocalError: local variable 'tablename' referenced before assignment
>
>
>
> On Sun, Sep 23, 2012 at 5:31 PM, Massimo Di Pierro 
> 
> > wrote:
>
>> I just added the syntax you requested:
>>
>> linked_tables=dict(parent=['**child'], child=[])
>>
>> Please help me test it.
>>
>>
>> On Saturday, 22 September 2012 18:55:57 UTC-5, Adi wrote:
>>>
>>> If I may rephrase and clarify a question: 
>>>
>>> Is it possible to add control, through dictionary in (smartgrid) 
>>> linked_tables when will links display?
>>>
>>> e.g: linked_tables=dict(parent=['**child'], child=[''])
>>>
>>> wishful outcome: display children links for parent table, but don't 
>>> display any related links for child table.
>>>
>>> Thanks,
>>> Adnan
>>>
>>>
>>> On Friday, September 21, 2012 11:58:05 AM UTC-4, Adi wrote:

 I'm wondering what to do in this situation? I have self-referencing 
 fields in the child table, and due to that smartgrid display links, which 
 basically can't do anything. 

 I'm trying to eliminate them, but not sure what would be a proper way? 

 Thanks.

 Simplified code sample: 
 db.define_table('campaign',
 Field('tbl_uuid', length=64, default=lambda:str(
 uuid.uuid4(**))),
 Field('name','string', label=T('Campaing Name')),
 format='%(name)s',
 )

 db.define_table('message',
 Field('tbl_uuid', length=64, default=lambda:str(
 uuid.uuid4(**))),
 Field('name','string', label=T('Name')),
 Field('campaign_id', 'reference campaign', label=T(
 'Campaign')),
 Field('action_yes_id', 'reference message)', label=
 T('Action Yes'),),
 Field('action_no_id', 'reference message)', label=T
 ('Action No')),
 migrate=True)



 grid=SQLFORM.smartgrid(Campaig**n, details=False, links_in_grid=True,
 linked_tables=['message'],
 #linked_tables=dict(campaign=[**'message'], 
 message=['']),
 links=dict(campaign=[lambda row:(_get_messages(row
 ))
 ]),
 )
 Enter code here...


  -- 
>>  
>>  
>>  
>>
>
>
>
> -- 
>
> Thanks,
> Adnan
>
> video: http://vimeo.com/24653283
>
>
>

-- 





[web2py] Re: sending emails on gae doesnt work

2012-09-23 Thread Massimo Di Pierro
I am not sure GAE supports HTML messages. Does it?

On Sunday, 23 September 2012 19:13:20 UTC-5, Pystar wrote:
>
> The thing is that I can send ordinary text messages, but sending html 
> messages fails.
>
> On Monday, September 24, 2012 12:52:42 AM UTC+1, howesc wrote:
>>
>> did you check the GAE logs?  remember that GAE won't send emails unless 
>> the from address is at least a viewer of the GAE application.
>>
>> please double check the GAE logs for warning messagesi think that is 
>> how google logs them.
>>
>> cfh
>>
>> On Sunday, September 23, 2012 3:35:16 PM UTC-7, Pystar wrote:
>>>
>>> These are the settings:
>>> auth.settings.register_onaccept = [messenger]
>>>
>>> mail=auth.settings.mailer
>>> mail.settings.server = 'gae'
>>> mail.settings.sender = 'user...@gmail.com'
>>> mail.settings.login = 'username:password'
>>>
>>> def messenger(form):
>>> context = dict(uniqueid=form.vars.uniqueid, 
>>> first_name=form.vars.first_name)
>>> message = response.render("message.html", context)
>>> mail.send(to=form.vars.email, subject="welcome to ICOP NIGERIA!", 
>>> message=[None, message])
>>>
>>> The surprising thing is that it works perfectly on localhost but fails 
>>> silently on GAE.
>>> I need help, its URGENT.
>>>
>>> On Sunday, September 23, 2012 10:41:45 PM UTC+1, Massimo Di Pierro wrote:

 Do you get an error?

 On Sunday, 23 September 2012 16:10:35 UTC-5, Pystar wrote:
>
> sending emails on gae doesnt work although it works perfectly on 
> localhost.
> I am using "gae" as settings
>


-- 





[web2py] Re: sending emails on gae doesnt work

2012-09-23 Thread Pystar
Is there a work around, I really need to send HTML emails or how can I 
include a clickable link inside a text email on GAE?

On Monday, September 24, 2012 1:17:26 AM UTC+1, Massimo Di Pierro wrote:
>
> I am not sure GAE supports HTML messages. Does it?
>
> On Sunday, 23 September 2012 19:13:20 UTC-5, Pystar wrote:
>>
>> The thing is that I can send ordinary text messages, but sending html 
>> messages fails.
>>
>> On Monday, September 24, 2012 12:52:42 AM UTC+1, howesc wrote:
>>>
>>> did you check the GAE logs?  remember that GAE won't send emails unless 
>>> the from address is at least a viewer of the GAE application.
>>>
>>> please double check the GAE logs for warning messagesi think that is 
>>> how google logs them.
>>>
>>> cfh
>>>
>>> On Sunday, September 23, 2012 3:35:16 PM UTC-7, Pystar wrote:

 These are the settings:
 auth.settings.register_onaccept = [messenger]

 mail=auth.settings.mailer
 mail.settings.server = 'gae'
 mail.settings.sender = 'user...@gmail.com'
 mail.settings.login = 'username:password'

 def messenger(form):
 context = dict(uniqueid=form.vars.uniqueid, 
 first_name=form.vars.first_name)
 message = response.render("message.html", context)
 mail.send(to=form.vars.email, subject="welcome to ICOP NIGERIA!", 
 message=[None, message])

 The surprising thing is that it works perfectly on localhost but fails 
 silently on GAE.
 I need help, its URGENT.

 On Sunday, September 23, 2012 10:41:45 PM UTC+1, Massimo Di Pierro 
 wrote:
>
> Do you get an error?
>
> On Sunday, 23 September 2012 16:10:35 UTC-5, Pystar wrote:
>>
>> sending emails on gae doesnt work although it works perfectly on 
>> localhost.
>> I am using "gae" as settings
>>
>

-- 





Re: [web2py] Re: smartgrid: linked_tables=dict(parent=['child'], child=[''])

2012-09-23 Thread Adnan Smajlovic
Works perfect. Thank you Massimo.


On Sun, Sep 23, 2012 at 8:16 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> Can you please try again?
>
>
> On Sunday, 23 September 2012 18:03:48 UTC-5, Adi wrote:
>
>> Thanks Massimo!
>>
>> I'm trying to test it, but got this error bellow:
>>
>>   File "/Users/adnan/web2py-trunk/**gluon/sqlhtml.py", line 2280, in 
>> smartgrid
>>
>> linked_tables = linked_tables.get(tablename,[]**)
>> UnboundLocalError: local variable 'tablename' referenced before assignment
>>
>>
>>
>> On Sun, Sep 23, 2012 at 5:31 PM, Massimo Di Pierro > > wrote:
>>
>>> I just added the syntax you requested:
>>>
>>> linked_tables=dict(parent=['**ch**ild'], child=[])
>>>
>>> Please help me test it.
>>>
>>>
>>> On Saturday, 22 September 2012 18:55:57 UTC-5, Adi wrote:

 If I may rephrase and clarify a question:

 Is it possible to add control, through dictionary in (smartgrid)
 linked_tables when will links display?

 e.g: linked_tables=dict(parent=['**ch**ild'], child=[''])

 wishful outcome: display children links for parent table, but don't
 display any related links for child table.

 Thanks,
 Adnan


 On Friday, September 21, 2012 11:58:05 AM UTC-4, Adi wrote:
>
> I'm wondering what to do in this situation? I have self-referencing
> fields in the child table, and due to that smartgrid display links, which
> basically can't do anything.
>
> I'm trying to eliminate them, but not sure what would be a proper way?
>
> Thanks.
>
> Simplified code sample:
> db.define_table('campaign',
> Field('tbl_uuid', length=64, default=lambda:str(
> uuid.uuid4())),
> Field('name','string', label=T('Campaing Name')),
> format='%(name)s',
> )
>
> db.define_table('message',
> Field('tbl_uuid', length=64, default=lambda:str(
> uuid.uuid4())),
> Field('name','string', label=T('Name')),
> Field('campaign_id', 'reference campaign', label=T
> ('Campaign')),
> Field('action_yes_id', 'reference message)', label
> =T('Action Yes'),),
> Field('action_no_id', 'reference message)', label=
> T('Action No')),
> migrate=True)
>
>
>
> grid=SQLFORM.smartgrid(Campaign, details=False, links_in_grid=True
> ,
> linked_tables=['message'],
> #linked_tables=dict(campaign=['message'],
> message=['']),
> links=dict(campaign=[lambda row:(_get_messages(row
> ))
> ]),
> )
> Enter code here...
>
>
>  --
>>>
>>>
>>>
>>
>

-- 





[web2py] Re: sending emails on gae doesnt work

2012-09-23 Thread howesc
here is what i do...


def connect_mail():
  """
  init the mail module
  """
  mail = Mail()  # mailer
  mail.settings.server = 'gae'  # your SMTP server
  mail.settings.sender='authorized sender ' # your 
email
  return mail


text_message = response.render('email/order_conf.txt',
   retval)
html_message = response.render('email/order_conf.html',
   retval)


logging.info(database.connect_mail().send(to=retval['customer'].email,

 subject="Online Order Confirmation - [%s]"%thisorder.id,
 message=(text_message, html_message),
 bcc=site_setting.get_site_settings_dict().setdefault(
 'order_email_bcc','no...@noone.com').split(',')))




that sends email with plaintext and html formatted content, with a bcc.

cfh


On Sunday, September 23, 2012 5:23:16 PM UTC-7, Pystar wrote:
>
> Is there a work around, I really need to send HTML emails or how can I 
> include a clickable link inside a text email on GAE?
>
> On Monday, September 24, 2012 1:17:26 AM UTC+1, Massimo Di Pierro wrote:
>>
>> I am not sure GAE supports HTML messages. Does it?
>>
>> On Sunday, 23 September 2012 19:13:20 UTC-5, Pystar wrote:
>>>
>>> The thing is that I can send ordinary text messages, but sending html 
>>> messages fails.
>>>
>>> On Monday, September 24, 2012 12:52:42 AM UTC+1, howesc wrote:

 did you check the GAE logs?  remember that GAE won't send emails unless 
 the from address is at least a viewer of the GAE application.

 please double check the GAE logs for warning messagesi think that 
 is how google logs them.

 cfh

 On Sunday, September 23, 2012 3:35:16 PM UTC-7, Pystar wrote:
>
> These are the settings:
> auth.settings.register_onaccept = [messenger]
>
> mail=auth.settings.mailer
> mail.settings.server = 'gae'
> mail.settings.sender = 'user...@gmail.com'
> mail.settings.login = 'username:password'
>
> def messenger(form):
> context = dict(uniqueid=form.vars.uniqueid, 
> first_name=form.vars.first_name)
> message = response.render("message.html", context)
> mail.send(to=form.vars.email, subject="welcome to ICOP NIGERIA!", 
> message=[None, message])
>
> The surprising thing is that it works perfectly on localhost but fails 
> silently on GAE.
> I need help, its URGENT.
>
> On Sunday, September 23, 2012 10:41:45 PM UTC+1, Massimo Di Pierro 
> wrote:
>>
>> Do you get an error?
>>
>> On Sunday, 23 September 2012 16:10:35 UTC-5, Pystar wrote:
>>>
>>> sending emails on gae doesnt work although it works perfectly on 
>>> localhost.
>>> I am using "gae" as settings
>>>
>>

-- 





[web2py] Re: sending emails on gae doesnt work

2012-09-23 Thread Pystar
I havent tried your method, but I got it working in a rather hackish way 
using simple string interpolation.This is what I did

message = "Dear %user, welcome to my site" % 
("pystar")
mail.send(to="blabla", subject="blabla", message=message)

That way, I can send HTML messages with inserted variables. But it would 
have been great if sending HTML emails worked out of the box

On Monday, September 24, 2012 2:07:28 AM UTC+1, howesc wrote:
>
> here is what i do...
>
>
> def connect_mail():
>   """
>   init the mail module
>   """
>   mail = Mail()  # mailer
>   mail.settings.server = 'gae'  # your SMTP server
>   mail.settings.sender='authorized sender 
> >' # your email
>   return mail
>
>
> text_message = response.render('email/order_conf.txt',
>retval)
> html_message = response.render('email/order_conf.html',
>retval)
>
>
> logging.info(database.connect_mail().send(to=retval['customer'].email,
>
>  subject="Online Order Confirmation - [%s]"%thisorder.id,
>  message=(text_message, html_message),
>  bcc=site_setting.get_site_settings_dict().setdefault(
>  'order_email_bcc','no...@noone.com ').
> split(',')))
>
>
>
>
> that sends email with plaintext and html formatted content, with a bcc.
>
> cfh
>
>
> On Sunday, September 23, 2012 5:23:16 PM UTC-7, Pystar wrote:
>>
>> Is there a work around, I really need to send HTML emails or how can I 
>> include a clickable link inside a text email on GAE?
>>
>> On Monday, September 24, 2012 1:17:26 AM UTC+1, Massimo Di Pierro wrote:
>>>
>>> I am not sure GAE supports HTML messages. Does it?
>>>
>>> On Sunday, 23 September 2012 19:13:20 UTC-5, Pystar wrote:

 The thing is that I can send ordinary text messages, but sending html 
 messages fails.

 On Monday, September 24, 2012 12:52:42 AM UTC+1, howesc wrote:
>
> did you check the GAE logs?  remember that GAE won't send emails 
> unless the from address is at least a viewer of the GAE application.
>
> please double check the GAE logs for warning messagesi think that 
> is how google logs them.
>
> cfh
>
> On Sunday, September 23, 2012 3:35:16 PM UTC-7, Pystar wrote:
>>
>> These are the settings:
>> auth.settings.register_onaccept = [messenger]
>>
>> mail=auth.settings.mailer
>> mail.settings.server = 'gae'
>> mail.settings.sender = 'user...@gmail.com'
>> mail.settings.login = 'username:password'
>>
>> def messenger(form):
>> context = dict(uniqueid=form.vars.uniqueid, 
>> first_name=form.vars.first_name)
>> message = response.render("message.html", context)
>> mail.send(to=form.vars.email, subject="welcome to ICOP NIGERIA!", 
>> message=[None, message])
>>
>> The surprising thing is that it works perfectly on localhost but 
>> fails silently on GAE.
>> I need help, its URGENT.
>>
>> On Sunday, September 23, 2012 10:41:45 PM UTC+1, Massimo Di Pierro 
>> wrote:
>>>
>>> Do you get an error?
>>>
>>> On Sunday, 23 September 2012 16:10:35 UTC-5, Pystar wrote:

 sending emails on gae doesnt work although it works perfectly on 
 localhost.
 I am using "gae" as settings

>>>

-- 





[web2py] Re: hideerror=True is being ignored in 2.0.x

2012-09-23 Thread Matt
Raised as issue.

http://code.google.com/p/web2py/issues/detail?id=1027

On Friday, September 21, 2012 12:35:56 AM UTC+12, Massimo Di Pierro wrote:
>
> Please open a ticket pointing to this thread. Thanks.
>
> On Thursday, 20 September 2012 00:11:49 UTC-5, Matt wrote:
>>
>> Hi there,
>>
>> I use custom forms in my app. I'm getting a problem whereby form errors 
>> divs are now appearing in the output of widgets. Even though I've 
>> suppressed them via hideerror=True.
>>
>> i.e. 
>>
>>  logging.info(form.custom.widget[field])
>>
>> returns
>>
>> > value="" />> id="name__error">enter a value
>>
>> When it used to only return:
>>
>> > value="" />
>>
>> I'm doing something along the lines of:
>>
>> def test_salon():
>>   response.view = 'testing/form.html'
>>
>>   form = SQLFORM(db.x)
>>
>>   if form.process(hideerror = True).accepted:
>> session.flash = 'YAY'
>>   elif form.errors:
>> response.flash = None
>>
>>   return dict(form = form)
>>
>> Then in the form.html
>>
>> {{= form.custom.begin }}
>>
>> {{ for field in form.fields: }}
>>
>> {{= form.custom.widget[field] }}
>>
>> {{ pass }}
>>
>> {{= BUTTON('Submit', _type = 'submit') }}
>>
>> {{= form.custom.end }}
>>
>> Cheers,
>> Matt
>>
>

-- 





[web2py] Re: sending emails on gae doesnt work

2012-09-23 Thread howesc
i remember this documented way to send HTML emails by sending a list of 
messages, first item in the list is plaintext, second item is HTML. 
 http://web2py.com/books/default/chapter/29/08#Combining-text-and-HTML-emails

actually, this is new to me, and apparently what you are 
using: http://web2py.com/books/default/chapter/29/08#HTML-emails

i would expect that you can use my response.render technique with the just 
HTML version that you used.  i saw a note on another thread recently that 
you must start your template with  (no spaces or newlines at the top) 
to get it to work properly.

let us know if you have further issues!

cfh

On Sunday, September 23, 2012 6:27:33 PM UTC-7, Pystar wrote:
>
> I havent tried your method, but I got it working in a rather hackish way 
> using simple string interpolation.This is what I did
>
> message = "Dear %user, welcome to my site" % 
> ("pystar")
> mail.send(to="blabla", subject="blabla", message=message)
>
> That way, I can send HTML messages with inserted variables. But it would 
> have been great if sending HTML emails worked out of the box
>
> On Monday, September 24, 2012 2:07:28 AM UTC+1, howesc wrote:
>>
>> here is what i do...
>>
>>
>> def connect_mail():
>>   """
>>   init the mail module
>>   """
>>   mail = Mail()  # mailer
>>   mail.settings.server = 'gae'  # your SMTP server
>>   mail.settings.sender='authorized sender ' # 
>> your email
>>   return mail
>>
>>
>> text_message = response.render('email/order_conf.txt',
>>retval)
>> html_message = response.render('email/order_conf.html',
>>retval)
>>
>>
>> logging.info(database.connect_mail().send(to=retval['customer'].email
>> ,
>>
>>  subject="Online Order Confirmation - [%s]"%thisorder.id,
>>  message=(text_message, html_message),
>>  bcc=site_setting.get_site_settings_dict().setdefault(
>>  'order_email_bcc','no...@noone.com').split(',')))
>>
>>
>>
>>
>> that sends email with plaintext and html formatted content, with a bcc.
>>
>> cfh
>>
>>
>> On Sunday, September 23, 2012 5:23:16 PM UTC-7, Pystar wrote:
>>>
>>> Is there a work around, I really need to send HTML emails or how can I 
>>> include a clickable link inside a text email on GAE?
>>>
>>> On Monday, September 24, 2012 1:17:26 AM UTC+1, Massimo Di Pierro wrote:

 I am not sure GAE supports HTML messages. Does it?

 On Sunday, 23 September 2012 19:13:20 UTC-5, Pystar wrote:
>
> The thing is that I can send ordinary text messages, but sending html 
> messages fails.
>
> On Monday, September 24, 2012 12:52:42 AM UTC+1, howesc wrote:
>>
>> did you check the GAE logs?  remember that GAE won't send emails 
>> unless the from address is at least a viewer of the GAE application.
>>
>> please double check the GAE logs for warning messagesi think that 
>> is how google logs them.
>>
>> cfh
>>
>> On Sunday, September 23, 2012 3:35:16 PM UTC-7, Pystar wrote:
>>>
>>> These are the settings:
>>> auth.settings.register_onaccept = [messenger]
>>>
>>> mail=auth.settings.mailer
>>> mail.settings.server = 'gae'
>>> mail.settings.sender = 'user...@gmail.com'
>>> mail.settings.login = 'username:password'
>>>
>>> def messenger(form):
>>> context = dict(uniqueid=form.vars.uniqueid, 
>>> first_name=form.vars.first_name)
>>> message = response.render("message.html", context)
>>> mail.send(to=form.vars.email, subject="welcome to ICOP 
>>> NIGERIA!", message=[None, message])
>>>
>>> The surprising thing is that it works perfectly on localhost but 
>>> fails silently on GAE.
>>> I need help, its URGENT.
>>>
>>> On Sunday, September 23, 2012 10:41:45 PM UTC+1, Massimo Di Pierro 
>>> wrote:

 Do you get an error?

 On Sunday, 23 September 2012 16:10:35 UTC-5, Pystar wrote:
>
> sending emails on gae doesnt work although it works perfectly on 
> localhost.
> I am using "gae" as settings
>


-- 





[web2py] Re: Using the template system to generate messages

2012-09-23 Thread Pystar
Kindly note that GAE doesnt support sending of HTML mails, so my solution 
wont work on GAE, check my solution to something related  
https://groups.google.com/forum/?fromgroups=#!topic/web2py/sR38-f677io 

On Sunday, September 23, 2012 8:15:36 PM UTC+1, Pystar wrote:
>
> Ok, I solved it. The trick is that message is first text, then html. So 
> the signature should read like this:
>
> context = dict(x=y)
> message = response.render("message.html", context)
> ***Please note that the message.html file should be in the top level of 
> your views folder or should be a absolute path to it.
>
> mail.send(to=[recipient],subject='subject',message=message) 
>
> will result in a text message. 
>
> to render as html, is :
>
> mail.send(to=[recipient],subject='subject',message=[None,message]) 
>
> On Sunday, September 23, 2012 8:05:24 PM UTC+1, Pystar wrote:
>>
>> Using this method, the mail is sent successfully,but shows raw html code 
>> in the email client, i.e. its not rendering
>>
>>
>> On Friday, September 7, 2012 4:19:45 PM UTC+1, Niphlod wrote:
>>>
>>> it's a path relative to the app's *views *folder. With this code your *
>>> message.html* should be next to layout.html, just in the *yourapp/views/
>>> * folder.
>>>
>>> Il giorno venerdì 7 settembre 2012 17:04:27 UTC+2, Daniel Gonzalez ha 
>>> scritto:

 As explained here:


 http://web2py.com/books/default/chapter/29/8#Using-the-template-system-to-generate-messages

 The following code can be used to render a view file to send via email:

 for person in db(db.person).select():
 context = dict(person=person)
 message = response.render('message.html', context)
 mail.send(to=['w...@example.com'],
   subject='None',
   message=message)

 I have tried this, but I am not able to place the "message.html" 
 correctly in the directory hierarchy.
 How does reponse.render find the view files, or, even better, how can I 
 tell response.render where to find my template file?

 Thanks,
 Daniel

>>>

-- 





[web2py] Re: sending emails on gae doesnt work

2012-09-23 Thread Pystar
Still doesnt work for me, so I will stick to my hackish way for now till I 
can look into it in more detail.

On Monday, September 24, 2012 2:58:17 AM UTC+1, howesc wrote:
>
> i remember this documented way to send HTML emails by sending a list of 
> messages, first item in the list is plaintext, second item is HTML.  
> http://web2py.com/books/default/chapter/29/08#Combining-text-and-HTML-emails
>
> actually, this is new to me, and apparently what you are using: 
> http://web2py.com/books/default/chapter/29/08#HTML-emails
>
> i would expect that you can use my response.render technique with the just 
> HTML version that you used.  i saw a note on another thread recently that 
> you must start your template with  (no spaces or newlines at the top) 
> to get it to work properly.
>
> let us know if you have further issues!
>
> cfh
>
> On Sunday, September 23, 2012 6:27:33 PM UTC-7, Pystar wrote:
>>
>> I havent tried your method, but I got it working in a rather hackish way 
>> using simple string interpolation.This is what I did
>>
>> message = "Dear %user, welcome to my site" % 
>> ("pystar")
>> mail.send(to="blabla", subject="blabla", message=message)
>>
>> That way, I can send HTML messages with inserted variables. But it would 
>> have been great if sending HTML emails worked out of the box
>>
>> On Monday, September 24, 2012 2:07:28 AM UTC+1, howesc wrote:
>>>
>>> here is what i do...
>>>
>>>
>>> def connect_mail():
>>>   """
>>>   init the mail module
>>>   """
>>>   mail = Mail()  # mailer
>>>   mail.settings.server = 'gae'  # your SMTP server
>>>   mail.settings.sender='authorized sender ' # 
>>> your email
>>>   return mail
>>>
>>>
>>> text_message = response.render('email/order_conf.txt',
>>>retval)
>>> html_message = response.render('email/order_conf.html',
>>>retval)
>>>
>>>
>>> logging.info(database.connect_mail().send(to=retval['customer'].
>>> email,
>>>
>>>  subject="Online Order Confirmation - [%s]"%thisorder.id
>>> ,
>>>  message=(text_message, html_message),
>>>  bcc=site_setting.get_site_settings_dict().setdefault(
>>>  'order_email_bcc','no...@noone.com').split(',')))
>>>
>>>
>>>
>>>
>>> that sends email with plaintext and html formatted content, with a bcc.
>>>
>>> cfh
>>>
>>>
>>> On Sunday, September 23, 2012 5:23:16 PM UTC-7, Pystar wrote:

 Is there a work around, I really need to send HTML emails or how can I 
 include a clickable link inside a text email on GAE?

 On Monday, September 24, 2012 1:17:26 AM UTC+1, Massimo Di Pierro wrote:
>
> I am not sure GAE supports HTML messages. Does it?
>
> On Sunday, 23 September 2012 19:13:20 UTC-5, Pystar wrote:
>>
>> The thing is that I can send ordinary text messages, but sending html 
>> messages fails.
>>
>> On Monday, September 24, 2012 12:52:42 AM UTC+1, howesc wrote:
>>>
>>> did you check the GAE logs?  remember that GAE won't send emails 
>>> unless the from address is at least a viewer of the GAE application.
>>>
>>> please double check the GAE logs for warning messagesi think 
>>> that is how google logs them.
>>>
>>> cfh
>>>
>>> On Sunday, September 23, 2012 3:35:16 PM UTC-7, Pystar wrote:

 These are the settings:
 auth.settings.register_onaccept = [messenger]

 mail=auth.settings.mailer
 mail.settings.server = 'gae'
 mail.settings.sender = 'user...@gmail.com'
 mail.settings.login = 'username:password'

 def messenger(form):
 context = dict(uniqueid=form.vars.uniqueid, 
 first_name=form.vars.first_name)
 message = response.render("message.html", context)
 mail.send(to=form.vars.email, subject="welcome to ICOP 
 NIGERIA!", message=[None, message])

 The surprising thing is that it works perfectly on localhost but 
 fails silently on GAE.
 I need help, its URGENT.

 On Sunday, September 23, 2012 10:41:45 PM UTC+1, Massimo Di Pierro 
 wrote:
>
> Do you get an error?
>
> On Sunday, 23 September 2012 16:10:35 UTC-5, Pystar wrote:
>>
>> sending emails on gae doesnt work although it works perfectly on 
>> localhost.
>> I am using "gae" as settings
>>
>

-- 





[web2py] Windows Binaries for Python Extension Packages

2012-09-23 Thread IVINH
can be used:

http://www.lfd.uci.edu/~gohlke/pythonlibs/

-- 





[web2py] web2py 2.0 DAL no longer usable for mysql stored procedures

2012-09-23 Thread Yarin
After upgrading to web2py 2.0, we can no longer use the DAL or mysql 
adapters to make MySQL stored procedure calls.

In web2py 1.x I had 
reportedhow 
mysql stored procedures weren't working for us in certain 
circumstances- however we were able to circumvent those issues by simply 
creating a new DAL instance everytime we had to call a sproc. With the new 
DAL, that's no longer an option- indeed, any call to a stored procedure 
seems to fail in any attempt through the DAL or mysql adapter. 

   - Fails with both pymysql and mysqldb drivers
   - Fails when calling commit() immediately after
   - We did side-by-side comparisons with web2py 1.x on same server, 
   pointing to same db, and confirmed this fails only in 2.0
   - You can make sproc calls using the DAL straight from the web2py shell, 
   but only if you don't call commit. 


Stack trace:

Traceback (most recent call last):
  File "/opt/web-apps/web2py/gluon/main.py", line 580, in wsgibase
BaseAdapter.close_all_instances('rollback')
  File "/opt/web-apps/web2py/gluon/dal.py", line 511, in close_all_instances
getattr(instance, action)()
  File "/opt/web-apps/web2py/gluon/dal.py", line 1633, in rollback
return self.connection.rollback()
ProgrammingError: (2014, "Commands out of sync; you can't run this command now")


Right now the only option is to make sproc calls directly through the 
pymysql driver API.


-- 





Re: [web2py] Invalid Syntax Error with HTML Helper attributes

2012-09-23 Thread mwolfe02
Right on both counts, Bruno.  Thanks.  I thought I was running the same 
Python version in both environments, but I was not.  I am running Python 
2.7.3 in my linux environment (which works without error) and Python 2.5.5 
on Windows (where I was receiving the error).

Your workaround was effective, but I think I'll just run my windows code on 
Python 2.7 to take advantage of the cleaner syntax.

Thanks much,
Mike

On Sunday, September 23, 2012 11:14:55 AM UTC-4, rochacbruno wrote:
>
> Check the Python version, Ive seem this error on 2.5 and early versions of 
> 2.6.
>
> workaround is.
>
> HELPER(*items, **{"_class": "value"})
>  
> Bruno Rocha
> http://rochacbruno.com.br
> mobile
>  Em 23/09/2012 11:45, "Michael Wolfe" > 
> escreveu:
>
>> I'm receiving an invalid syntax error when running from Windows.  I do not 
>> receive the error when running the same code from my Webfaction account on 
>> CentOS.  The error appears to be related to compiling of the code.  I assume 
>> the compile code is taking issue with the HTML helper functions which allow 
>> _myattribute="Value" to be translated into the HTML myattribute="Value".  Am 
>> I just missing something simple?  This has been driving me crazy.  
>>
>> Thanks,
>> Mike
>>
>> Traceback (most recent call last):
>>
>>
>>   File "M:\My Documents\EstateCommander\web2py\gluon\restricted.py", line 
>> 208, in restricted
>>
>>
>> ccode = compile2(code,layer)
>>   File "M:\My Documents\EstateCommander\web2py\gluon\restricted.py", line 
>> 193, in compile2
>>
>>
>> return compile(code.rstrip().replace('\r\n','\n')+'\n', layer, 'exec')
>>
>>
>>   File "C:/Users/Mike/Documents/My 
>> Dropbox/EstateCommander/web2py/applications/estate/controllers/forms.py" 
>> , line 
>> 15
>>
>>
>> table = TABLE(*rows, _border="0", _align="center", _width="50%")
>>
>>
>>^
>> SyntaxError: invalid syntax
>>
>>  -- 
>>  
>>  
>>  
>>
>

-- 





[web2py] Re: log out user

2012-09-23 Thread Yebach
Where do I insert the code? In model?

this is now my code in db.py

if session['school_db'] != request.cookies['mycookie'].value:
auth.logout()
session['school_db'] = request.cookies['mycookie'].value

But I get an error 
'NoneType' object has no attribute 'insert'

seems like smth is wrong with auth.logout()

On Friday, September 21, 2012 6:03:59 PM UTC+2, Massimo Di Pierro wrote:
>
> After login your user info is loaded into session. You need to add 
> something like
>
> if session.dbname != current_db_name:
> auth.logout()
> session.dbname = current_db_name
>
>
> On Friday, 21 September 2012 07:47:08 UTC-5, Yebach wrote:
>>
>> Hello
>>
>> You can see my app on portal.iurnik.si  
>>
>> I have the following problem 
>> after user selects a school app connects to a specific database where 
>> data is read from. On that database the auth tables are created so 
>> registered users can download some documents.
>> The problems occurs if I log in on one school (database) and then I go 
>> back to main page, select a new database I am already logged in. How?? I 
>> mean auth tables are created on db but the user is not. How can I solve 
>> this?
>>
>> I am reading database name from cookie
>>
>> Thank you
>>
>>
>>

--