I find my problem. 
I define all my tables in my_table.py models file. 
This files is loaded by web2py after the menu.py file. 
So category is not know at the moment of menu.py logic is loaded and return 
an error.

I define my models logic in a db1.py file now and all is ok

Thanks for your reply :)

Le samedi 13 septembre 2014 16:23:35 UTC+2, Niphlod a écrit :
>
> any db.category call must go after db.define_table('category'). Have you 
> checked it ?
>
> On Friday, September 12, 2014 8:05:27 AM UTC+2, olivier hubert wrote:
>>
>> I try implement Reddit clone from massimo video (2013 edition), but I 
>> have a strange problem with the dynamic menu construction part.
>>
>> My menu.py (I remove all comments):
>>
>> response.logo = A(B('web',SPAN(2),'py'),XML('™ '),
>>                   _class="brand",_href="http://www.web2py.com/";)
>> response.title = request.application.replace('_',' ').title()
>> response.subtitle = ''
>>
>> response.meta.author = 'Your Name <y...@example.com>'
>> response.meta.keywords = 'web2py, python, framework'
>> response.meta.generator = 'Web2py Web Framework'
>>
>> response.google_analytics_id = None
>>
>> response.menu = [
>>     (T('Home'), False, URL('default', 'index'))
>> ]
>>
>> row = db(db.category).select().first()
>>
>> I receive an error AttributeError: 'DAL' object has no attribute 
>> 'category'
>>
>> But, if I execute the code db(db.category).select().first() in a shell 
>> window I get my first category.
>>
>> In [2] : db(db.category).select().first()
>> <Row {'id': 4L, 'name': 'voiture'}>
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to