Fabio schrieb:
> Hi!
> I solved (partially) my problem: very thanks.
>
> I studied acquisition and then I understood your example.
>
> I've another problem (the last, I hope): I call some ZSQLMethod from
> Python scripts so I need to execute a command dynamically.
> example
>  I need to execute
> 'container.include.sql.%s.getX()' % container.REQUEST.SESSION['dbconn']
>
> but 'exec' is not allowed. Does exist another way or I have to write:
> if container.REQUEST.SESSION['dbconn'] == 'conn1':
>     container.include.sql.conn1.getX()
> elif container.REQUEST.SESSION['dbconn'] == 'conn2':
>     container.include.sql.conn2.getX()
> elif ...
>
> ?
>
> In ZPT pages I use python:path('python:container.%s.getX()' % var) without
> problem but I don't knoe how do the same thing in a script python.
>

Well, thats just python - I'd suggest skimming thru the python
tutorial at python.org at least.

You reach objects by getattr(parent,attributename)
And in Zope also via:

parent[attributename]

This should get you going I think.

Regards
Tino
_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to