[Zope3-checkins] CVS: Zope3/src/zope/app/rdb - __init__.py:1.16
Sidnei da Silva
sidnei@x3ng.com.br
Thu, 3 Jul 2003 18:46:47 -0400
Update of /cvs-repository/Zope3/src/zope/app/rdb
In directory cvs.zope.org:/tmp/cvs-serv1282/src/zope/app/rdb
Modified Files:
__init__.py
Log Message:
Whitespace cleanup, changed some ContextMethods by zapi.ContextMethod, use constant for service name, corrected some labels on SQLScript. There was this ugly code on zope.app.rdb that I couldnt figure out how to fix. I need help from srichter.
=== Zope3/src/zope/app/rdb/__init__.py 1.15 => 1.16 ===
--- Zope3/src/zope/app/rdb/__init__.py:1.15 Wed Jun 11 09:47:59 2003
+++ Zope3/src/zope/app/rdb/__init__.py Thu Jul 3 18:46:12 2003
@@ -272,11 +272,21 @@
## if [x for x in converters if x is not ZopeDatabaseAdapter.identity]:
## return results # optimize away
+## XXX Geez! This was badly broken for me, and srichter was not
+## around to explain what this code is supposed to do when
+## theres only one row/one column on the result.
+
def convertRow(row):
- return map(lambda converter, value: converter(value),
- converters, row)
- return map(convertRow, results)
+ try:
+ return map(lambda converter, value: converter(value),
+ converters, row)
+ except TypeError:
+ return converters[0](row)
+ try:
+ return map(convertRow, results)
+ except TypeError:
+ return convertRow(results)
class ZopeConnection: