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 <[email protected] <javascript:>>'
> 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 [email protected].
For more options, visit https://groups.google.com/d/optout.