ZSQL method from python script
Hello! How can I call ZSQL method, from python script? And how can I use the result set of the ZSQL method? Thanks: Lajos Kerekes
Kerekes Lajos wrote:
Hello!
How can I call ZSQL method, from python script? And how can I use the result set of the ZSQL method?
Thanks:
Lajos Kerekes
Since this email, I found some help in Zope Book, but still I have error. I have an "update" ZSQL method, the argument is 'id'. If I call it from python script in this way: ------------------ for result in context.updateState(id): ------------------ I get an error. ----------- Error Type: Bad Request Error Value: ['id'] . . . . File /usr/local/zope/Zope-2.3.3-linux2-x86/lib/python/Shared/DC/ZRDB/Aqueduct.py, line 150, in _argdata (Object: updateMLState) Bad Request: (see above) ----------- What is the problem. Thanks: Lajos
try passing the id argument more explicitly, like... for result in context.updateState(id=id): ... (assuming id is defined in your python script) IMHO, for one's own sanity, it's always better to pass explicit named arguments to a method. jens On Monday, July 30, 2001, at 08:36 , Kerekes Lajos wrote:
Kerekes Lajos wrote:
Hello!
How can I call ZSQL method, from python script? And how can I use the result set of the ZSQL method?
Thanks:
Lajos Kerekes
Since this email, I found some help in Zope Book, but still I have error. I have an "update" ZSQL method, the argument is 'id'. If I call it from python script in this way: ------------------ for result in context.updateState(id): ------------------
I get an error. ----------- Error Type: Bad Request Error Value: ['id'] . . . . File /usr/local/zope/Zope-2.3.3-linux2-x86/lib/python/Shared/DC/ZRDB/Aqueduct. py,
line 150, in _argdata (Object: updateMLState) Bad Request: (see above) -----------
What is the problem.
Thanks:
Lajos
Jens Vagelpohl wrote:
try passing the id argument more explicitly, like...
for result in context.updateState(id=id): ...
(assuming id is defined in your python script)
IMHO, for one's own sanity, it's always better to pass explicit named arguments to a method.
jens
Thanks all for help. It has already worked. Lajos
just like in external methods. for record in context.select_names_sql(name='peter'): print record.firstname + "<br>" + record.lastname Or (but I'm not sure this is good practice but it works) # if the SQL method returns only one record recordset = context.select_names_sql(name='peter') return recordset.firstname Peter ----- Original Message ----- From: "Kerekes Lajos" <lkerekes@xperts.hu> To: <zope@zope.org> Sent: Monday, July 30, 2001 12:40 PM Subject: [Zope] ZSQL method from python script
Hello!
How can I call ZSQL method, from python script? And how can I use the result set of the ZSQL method?
Thanks:
Lajos Kerekes
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
participants (3)
-
Jens Vagelpohl -
Kerekes Lajos -
Peter Bengtsson