> db.define_table('store_catalog',
>> Field('title'),
>> Field('slug',requires=IS_SLUG(),compute=lambda row:
>> IS_SLUG.urlify(row.titl\
>> e)),
>> Field('parent_id','reference store_catalog'))
>>
>> id1 = db.store_catalog.insert(title='main')
>> id2 = db.store_catalog.insert(title='one',parent_id=id1)
>> id3 = db.store_catalog.insert(title='two',parent_id=id2)
>>
>> def menu_rec(items): return
>> [(x.title,None,URL('action',args=x.slug),menu_rec(x\
>> .children)) for x in items or []]
>> response.menu = menu_rec(db(db.store_catalog).select().as_trees())
>> print response.menu
>>
>
Hi!
Is there a more modern solution to this issue?
Raises an error - need more than 0 values to unpack
If to substitute
return [((x.title,None,URL('action',args=x.slug),menu_rec(x.children)) for
x in items or []), False, URL('default')]
it shows - but an error
--
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.