Should have a 'quick tips and advices' section on the book for this kind of
stuff. May be a blockquote on DAL chapter. Too much information that get
lost in google group.

Need to be documented as soon we catch this.
Em 05/05/2011 11:17, "Massimo Di Pierro" <massimo.dipie...@gmail.com>
escreveu:
> good catch. Actually the safest thing is
>
> default=lambda:str(uuid.uuid4())
>
> since uuid4() returns an object, not a string.
>
>
> On May 5, 9:10 am, Anthony <abasta...@gmail.com> wrote:
>> Also, you might want default=uuid.uuid4 instead of default=uuid.uuid4().
I
>> believe the former will call the uuid4 function separately for every
record
>> inserted (probably what you want), whereas the latter will generate a
single
>> unique uuid only once per call to db.define_table (which presumably may
>> endure for more than one record insert, depending on what your code
does).
>>
>> Anthony
>>
>>
>>
>>
>>
>>
>>
>> On Wednesday, May 4, 2011 11:49:42 PM UTC-4, mart wrote:
>> > Hi,
>>
>> > I think I may have been looking at this too long... its giving the
>> > following error, and I can't see why...
>> > (using DAL in script)
>>
>> > Thanks in advance,
>> > Mart :)
>>
>> >         db.define_table('mail',
>> >             Field('uuid',length=64,default=uuid.uuid4()),
>> >             Field('recipients','list:string'),Field('From'),
>> >             Field('password'),Field('smtp_server'),Field('smtp_port'))
>> >         db.commit()
>>
>> > Traceback (most recent call last):
>> >   File "/Users/mart/Applications/Aptana Studio 2.0/plugins/
>> > org.python.pydev.debug_1.6.5.2011020317/pysrc/pydevd.py", line 1133,
>> > in <module>
>> >     debugger.run(setup['file'], None, None)
>> >   File "/Users/mart/Applications/Aptana Studio 2.0/plugins/
>> > org.python.pydev.debug_1.6.5.2011020317/pysrc/pydevd.py", line 918, in
>> > run
>> >     execfile(file, globals, locals) #execute the script
>> >   File "/Users/mart/aptanaApps/src/_purple.py", line 524, in <module>
>> >     dbBlueObj.defineTables()
>> >   File "/Users/mart/aptanaApps/src/blueLite/db_storage/db_blue.py",
>> > line 278, in defineTables
>> >     Field('password'),Field('smtp_server'),Field('smtp_port'))
>> >   File "/Users/mart/aptanaApps/src/blueLite/pyUtils/sql/web2py/
>> > dal.py", line 4028, in define_table
>> >     polymodel=polymodel)
>> >   File "/Users/mart/aptanaApps/src/blueLite/pyUtils/sql/web2py/
>> > dal.py", line 590, in create_table
>> >     self.create_sequence_and_triggers(query,table)
>> >   File "/Users/mart/aptanaApps/src/blueLite/pyUtils/sql/web2py/
>> > dal.py", line 1142, in create_sequence_and_triggers
>> >     self.execute(query)
>> >   File "/Users/mart/aptanaApps/src/blueLite/pyUtils/sql/web2py/
>> > dal.py", line 1152, in execute
>> >     return self.log_execute(*a, **b)
>> >   File "/Users/mart/aptanaApps/src/blueLite/pyUtils/sql/web2py/
>> > dal.py", line 1147, in log_execute
>> >     ret = self.cursor.execute(*a,**b)
>> > sqlite3.OperationalError: near "From": syntax error

Reply via email to