I see where there error is happening: I'm doing a crud.create
as the record is being built it gets to: if fields[fieldname] != None and isinstance(self.table,Table) and not keyed: fields[fieldname] = int(fields[fieldname]) in sqlhml.py sid has value '' in db.py I have SQLField("sid",db.auth_user,default=user_id), so shouldn't '' be the default=user_id value when it get's to that point as sid can't be anything here as it is created from a reference value and will be blank unless it get's the value from the reference value part. Right?? I noticed this code in sqlhtml.py (line 576): if record: default = record[fieldname] else: default = field.default but field.default is '' when it get's to sid, shouldn't it be user_id? thx, -wes On Wed, Nov 18, 2009 at 5:25 PM, mdipierro <mdipie...@cs.depaul.edu> wrote: > > Your error says: > > ValueError: invalid literal for int() with base 10: '' > > so there is a '' in the default somehow. > > On Nov 18, 6:00 pm, Wes James <compte...@gmail.com> wrote: >> so is the db.auth_user the problem or the default=user_id >> >> I took the default=user_id from the db.py in the book: >> >> if auth.is_logged_in(): >> user_id = auth.user.id >> else: >> user_id = None >> >> book page 72 >> >> On Wed, Nov 18, 2009 at 4:47 PM, mdipierro <mdipie...@cs.depaul.edu> wrote: >> >> > The default for a reference field must be None or an int or a string >> > containing and int. It cannot be an empty string. It is ambiguous. It >> > is not clear if it should be a None or a 0. >> >> > On Nov 18, 4:48 pm, Wes James <compte...@gmail.com> wrote: >> >> What does this mean: >> >> >> form=crud.create(db.student,next=URL(r=request)) >> >> File "/opt/cnrsa/gluon/tools.py", line 2101, in create >> >> deletable=False, >> >> File "/opt/cnrsa/gluon/tools.py", line 2048, in update >> >> keepvalues=self.settings.keepvalues): >> >> File "/opt/cnrsa/gluon/sqlhtml.py", line 865, in accepts >> >> fields[fieldname] = int(fields[fieldname]) >> >> ValueError: invalid literal for int() with base 10: '' >> >> >> I get it with this: >> >> >> SQLField("sid",db.auth_user, default=user_id), >> >> >> but not with this: >> >> >> SQLField("sid",default=user_id), >> >> >> -wes >> >> > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" 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 -~----------~----~----~----~------~----~------~--~---