I realized at the grocery store last night that entering 0 (which I
assume is an invalid ID) instead of nothing (equal to '') would
resolve the problem because:

>>> x = int('')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: invalid literal for int() with base 10: ''

But what I don't understand is why the examples in the book don't have
that problem:

http://www.web2py.com/book/default/chapter/06#Self-Reference-and-Aliases

And, of course, I'm too noob to know what the code web2py code should
actually do.

On Oct 16, 3:54 pm, mdipierro <[email protected]> wrote:
> this should now be default behavior in trunk.No need for
> db.test.referes_to.requires=IS_EMPTY_OR(IS_IN_DB(db,'test.refers_to'))
>
> please check it.
>

I still get pretty much the same exception:

Traceback (most recent call last):
  File "/home/witr/Desktop/web2pytrunk/gluon/restricted.py", line 188,
in restricted
    exec ccode in environment
  File "/home/witr/Desktop/web2pytrunk/applications/test/controllers/
default.py", line 59, in <module>
  File "/home/witr/Desktop/web2pytrunk/gluon/globals.py", line 96, in
<lambda>
    self._caller = lambda f: f()
  File "/home/witr/Desktop/web2pytrunk/applications/test/controllers/
default.py", line 12, in create
    form = crud.create(db.test, next = URL('index'))
  File "/home/witr/Desktop/web2pytrunk/gluon/tools.py", line 2864, in
create
    deletable=False,
  File "/home/witr/Desktop/web2pytrunk/gluon/tools.py", line 2807, in
update
    hideerror=self.settings.hideerror):
  File "/home/witr/Desktop/web2pytrunk/gluon/sqlhtml.py", line 1074,
in accepts
    fields[fieldname] = int(fields[fieldname])
ValueError: invalid literal for int() with base 10: ''

Reply via email to