When request.args(0) is 628
> from gluon.storage import Storage
> session[request.args(0)] = Storage(id=request.args(0))
> # now it's a Storage object, so you can start adding new keys
> session[request.args(0)].otherkey = "other value"
>
Is this equivalent to session6 = {'id':6} or 6={'id':6}
I am asking this because the following:
from gluon.storage import Storage
> session[request.args(0)] = Storage()
> id = session[request.args(0)].id = request.args(0)
>
> Then everywhere you currently refer to session[request.args(0)].id, you
> can simply use id (even without the above, you could just use
> request.args(0) itself, since it is equivalent to
> session[requests.args(0)].id).
>
.... isn't completely clear to me, when I have created Storage object for
node with id 6, node with id 28 and node with id 34 and have set every
objects key to the corresponding values, then what you're saying is that
6.menu renders node 6's menu and 28.menu renders node 28's menu?
Finally, do you even need the "id" key, given that it is the same as the
> name of its parent object? Couldn't you just do:
>
> from gluon.storage import Storage
> id = request.args(0)
> session[id] = Storage()
> session[id].somekey = 'some value'
>
If I understood you correctly, I think I can.
Kind regards,
Annet
--