[Zope-CVS] SVN: psycopgda/trunk/adapter.py Refactor type registration so it can be done without constructing a PsycopgAdapter instance

Stuart Bishop stuart at stuartbishop.net
Mon Jan 31 07:15:19 EST 2005


Log message for revision 28989:
  Refactor type registration so it can be done without constructing a PsycopgAdapter instance

Changed:
  U   psycopgda/trunk/adapter.py

-=-
Modified: psycopgda/trunk/adapter.py
===================================================================
--- psycopgda/trunk/adapter.py	2005-01-31 12:12:24 UTC (rev 28988)
+++ psycopgda/trunk/adapter.py	2005-01-31 12:15:19 UTC (rev 28989)
@@ -296,7 +296,16 @@
                       'username': 'user',
                       'password': 'password'}
 
-
+def registerTypes():
+    """Register type conversions for psycopg"""
+    psycopg.register_type(DATE)
+    psycopg.register_type(TIME)
+    psycopg.register_type(TIMETZ)
+    psycopg.register_type(TIMESTAMP)
+    psycopg.register_type(TIMESTAMPTZ)
+    psycopg.register_type(INTERVAL)
+    psycopg.register_type(STRING)
+ 
 class PsycopgAdapter(ZopeDatabaseAdapter):
     """A PsycoPG adapter for Zope3.
 
@@ -325,11 +334,6 @@
 
     def _registerTypes(self):
         """Register type conversions for psycopg"""
-        psycopg.register_type(DATE)
-        psycopg.register_type(TIME)
-        psycopg.register_type(TIMETZ)
-        psycopg.register_type(TIMESTAMP)
-        psycopg.register_type(TIMESTAMPTZ)
-        psycopg.register_type(INTERVAL)
-        psycopg.register_type(STRING)
-            
+        registerTypes()
+
+           



More information about the Zope-CVS mailing list