It works in the normal shell

python web2py.py -S yourapp -M -n

It does not  work on the web based shell for the same reason here:

http://groups.google.com/group/web2py/browse_thread/thread/f33577079802501e#

On Jan 12, 8:36 am, dederocks <[email protected]> wrote:
> I've tried to run the following example, a copy-paste from the book.
> What am I doing wrong?
>
> my model:
>
> db.define_table('person', Field('name'))
>
> db.define_table('dog', Field('name'), Field('owner',db.person))
>
> in the shell:
> web2py Shell Version 1.91.6 (2011-01-10 20:54:45)
> In [1] : db.person.insert(name='Alex')
> 1
>
> In [2] : db.person.insert(name='Bill')
> 2
>
> In [3] : db.dog.insert(name='medor',owner=1)
> 1
>
> In [4] : dogs = db(db.dog.id>0).select()
>
> In [5] : for dog in dogs: print dog.name, dog.owner.name
> Traceback (most recent call last):
>   File "C:\Users\Andre\Documents\web2py\gluon\contrib\shell.py", line
> 225, in run
>     exec compiled in statement_module.__dict__
>   File "<string>", line 1, in <module>
> AttributeError: 'dict' object has no attribute 'name'

Reply via email to