[Zope-Checkins] CVS: Zope/lib/python/Shared/DC/ZRDB - DA.py:1.106.10.1

R. David Murray bitz@bitdance.com
Mon, 16 Dec 2002 16:40:47 -0500


Update of /cvs-repository/Zope/lib/python/Shared/DC/ZRDB
In directory cvs.zope.org:/tmp/cvs-serv11284

Modified Files:
      Tag: rdmurray-collector322-branch
	DA.py 
Log Message:
Fix for Collector 322: if you use 'client' as an argument in a
ZSQL method, you get a confusing TypeError claiming that 'client'
is defined twice.  This fix just catches that error and produces
a more useful error message, said message being that you can't use
client as an argument name.


=== Zope/lib/python/Shared/DC/ZRDB/DA.py 1.106 => 1.106.10.1 ===
--- Zope/lib/python/Shared/DC/ZRDB/DA.py:1.106	Fri Nov 22 21:07:06 2002
+++ Zope/lib/python/Shared/DC/ZRDB/DA.py	Mon Dec 16 16:40:47 2002
@@ -426,7 +426,14 @@
 
         security=getSecurityManager()
         security.addContext(self)
-        try:     query=apply(self.template, (p,), argdata)
+        try:
+            try:     query=apply(self.template, (p,), argdata)
+            except TypeError, msg:
+                msg = str(msg)
+                if find(msg,'client'):
+                    raise NameError("'client' may not be used as an " +
+                        "argument name in this context")
+                else: raise
         finally: security.removeContext(self)
 
         if src__: return query