In debugging some Z SQL methods I found it quite hard to diagnose certain
errors returned by the database backend because Zope doesn't return the SQL
sent to the server, instead it returns "Could not render the query
template!" which is not really true for this case.

In looking at the source code of DA.py (lib/python/Shared/DC/ZRDB), and I
think I found a simple solution:

in manage_test insert the following indented after line 343 (except:)

try: src=self(REQUEST, src__=1)
except: pass

This re-renders the query template if possible without sending it to the
backend and returns the SQL in src. The result is your backend error message
followed by the SQL generated. This should really save time debugging any
dynamic Z SQL methods.

It was moderately tested on Zope 2.2.1/PostgreSQL 7 via PyGreSQLDA. It
should not be database dependant though.

Enjoy.
-Casey Duncan


_______________________________________________
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )

Reply via email to