I think you are misunderstanding the error message. BadValueError: Property size must be a float
The error message is saying you must pass in a 'float'ing point number, and 0 is not a floating point number. # This does not work gdb = GQLDB() gdb.define_table('potato',gdb.Field('size','double',default=0)) gdb.potato.insert() # This works gdb = GQLDB() gdb.define_table('potato',gdb.Field('size','double',default=0.0)) gdb.potato.insert() I am not a fan of type coercion, because it will mask bugs. Robin On Feb 9, 4:54 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > correction. You can insert an empty records if at least one field has > a default value. From your email it there seems to be a problem on > GAE. > > @Robin. Can you double check this one? > > Massimo > > On Feb 9, 4:40 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > double is correct. > > > Currently you cannot insert an empty record > > > db.potato.insert() > > > even if fields have a default. I can change it. > > > On Feb 9, 4:08 pm, "Sebastian E. Ovide" <sebastianov...@gmail.com> > > wrote: > > > > Hi Massimo, > > > > is this a bug ? > > > > the following model wont work on GAE: > > > > db.define_table('potato', > > > # SQLField('size','float',default=0) > > > SQLField('size','double',default=0) > > > ) > > > > db(db.potato.id>0).delete() > > > if len(db(db.potato.id>0).select())==0: > > > db.potato.insert() > > > mydb=db(db.potato.id>0).select()[0] > > > > it says > > > > ERROR 2009-02-09 22:01:07,757 main.py] Traceback (most recent call > > > last): > > > File "C:\dev\quadraforte\reborn\qoofer\gluon\restricted.py", line 98, in > > > restricted > > > exec ccode in environment > > > File "C:\dev\quadraforte\reborn\qoofer\applications\tests/models/db.py", > > > line 16, in <module> > > > db.potato.insert() > > > File "C:\dev\quadraforte\reborn\qoofer\gluon\contrib\gql.py", line 298, > > > in > > > insert > > > tmp = self._tableobj(**fields) > > > File > > > "C:\Programmi\Google\google_appengine\google\appengine\ext\db\__init__.py", > > > line 588, in __init__ > > > prop.__set__(self, value) > > > File > > > "C:\Programmi\Google\google_appengine\google\appengine\ext\db\__init__.py", > > > line 388, in __set__ > > > value = self.validate(value) > > > File > > > "C:\Programmi\Google\google_appengine\google\appengine\ext\db\__init__.py", > > > line 2135, in validate > > > raise BadValueError('Property %s must be a float' % self.name) > > > BadValueError: Property size must be a float > > > > and if I set it as float it says: > > > > ERROR 2009-02-09 22:05:50,595 main.py] Traceback (most recent call > > > last): > > > File "C:\dev\quadraforte\reborn\qoofer\gluon\restricted.py", line 98, in > > > restricted > > > exec ccode in environment > > > File "C:\dev\quadraforte\reborn\qoofer\applications\tests/models/db.py", > > > line 10, in <module> > > > SQLField('size','float',default=0) > > > File "C:\dev\quadraforte\reborn\qoofer\gluon\contrib\gql.py", line 167, > > > in > > > define_table > > > t._create() > > > File "C:\dev\quadraforte\reborn\qoofer\gluon\contrib\gql.py", line 265, > > > in > > > _create > > > raise SyntaxError, 'SQLField: unkown field type' > > > SyntaxError: SQLField: unkown field type --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---