[CalendarServer-changes] [14427] CalendarServer/branches/users/wsanchez/psycopg2cffi

source_changes at macosforge.org source_changes at macosforge.org
Wed Feb 18 13:12:36 PST 2015


Revision: 14427
          http://trac.calendarserver.org//changeset/14427
Author:   wsanchez at apple.com
Date:     2015-02-18 13:12:36 -0800 (Wed, 18 Feb 2015)
Log Message:
-----------
pgdb->psycopg2cffi

Modified Paths:
--------------
    CalendarServer/branches/users/wsanchez/psycopg2cffi/calendarserver/tap/util.py
    CalendarServer/branches/users/wsanchez/psycopg2cffi/requirements-stable.txt
    CalendarServer/branches/users/wsanchez/psycopg2cffi/setup.py
    CalendarServer/branches/users/wsanchez/psycopg2cffi/twistedcaldav/database.py
    CalendarServer/branches/users/wsanchez/psycopg2cffi/twistedcaldav/directory/test/test_proxyprincipaldb.py
    CalendarServer/branches/users/wsanchez/psycopg2cffi/txdav/base/datastore/subpostgres.py

Modified: CalendarServer/branches/users/wsanchez/psycopg2cffi/calendarserver/tap/util.py
===================================================================
--- CalendarServer/branches/users/wsanchez/psycopg2cffi/calendarserver/tap/util.py	2015-02-18 19:31:43 UTC (rev 14426)
+++ CalendarServer/branches/users/wsanchez/psycopg2cffi/calendarserver/tap/util.py	2015-02-18 21:12:36 UTC (rev 14427)
@@ -161,8 +161,8 @@
     """
     Create a postgres DB-API connector from the given configuration.
     """
-    import pgdb
-    return DBAPIConnector(pgdb, postgresPreflight, config.DSN).connect
+    import psycopg2cffi as postgres
+    return DBAPIConnector(postgres, postgresPreflight, config.DSN).connect
 
 
 

Modified: CalendarServer/branches/users/wsanchez/psycopg2cffi/requirements-stable.txt
===================================================================
--- CalendarServer/branches/users/wsanchez/psycopg2cffi/requirements-stable.txt	2015-02-18 19:31:43 UTC (rev 14426)
+++ CalendarServer/branches/users/wsanchez/psycopg2cffi/requirements-stable.txt	2015-02-18 21:12:36 UTC (rev 14427)
@@ -52,7 +52,7 @@
             #pyobjc-framework-OpenDirectory  # Use system module
 
         # [Postgres] extra
-            PyGreSQL==4.1.1
+            psycopg2cffi==2.6.1
 
         # [Oracle] extra
             #cx_Oracle==5.1.3  # Not in PyPI

Modified: CalendarServer/branches/users/wsanchez/psycopg2cffi/setup.py
===================================================================
--- CalendarServer/branches/users/wsanchez/psycopg2cffi/setup.py	2015-02-18 19:31:43 UTC (rev 14426)
+++ CalendarServer/branches/users/wsanchez/psycopg2cffi/setup.py	2015-02-18 21:12:36 UTC (rev 14427)
@@ -271,7 +271,7 @@
     "LDAP": ["twextpy[LDAP]"],
     "OpenDirectory": ["twextpy[OpenDirectory]"],
     "Oracle": ["twextpy[Oracle]", "cx_Oracle"],
-    "Postgres": ["twextpy[Postgres]", "PyGreSQL"],
+    "Postgres": ["twextpy[Postgres]", "psycopg2cffi"],
 }
 
 

Modified: CalendarServer/branches/users/wsanchez/psycopg2cffi/twistedcaldav/database.py
===================================================================
--- CalendarServer/branches/users/wsanchez/psycopg2cffi/twistedcaldav/database.py	2015-02-18 19:31:43 UTC (rev 14426)
+++ CalendarServer/branches/users/wsanchez/psycopg2cffi/twistedcaldav/database.py	2015-02-18 21:12:36 UTC (rev 14427)
@@ -17,10 +17,9 @@
 import thread
 
 try:
-    import pgdb
-except:
-    pgdb = None
-# pgdb = None
+    import psycopg2cffi as postgres
+except ImportError:
+    postgres = None
 
 from twisted.enterprise.adbapi import ConnectionPool
 from twisted.internet.defer import inlineCallbacks, returnValue
@@ -571,7 +570,7 @@
         # internal statements so we do not need to remap those
         return sql
 
-if pgdb:
+if postgres:
 
     class ADBAPIPostgreSQLMixin(object):
 
@@ -608,7 +607,7 @@
 
             try:
                 yield self._db_execute(statement)
-            except pgdb.DatabaseError:
+            except postgres.DatabaseError:
 
                 if not ifnotexists:
                     raise
@@ -638,7 +637,7 @@
 
             try:
                 yield self._db_execute(statement)
-            except pgdb.DatabaseError:
+            except postgres.DatabaseError:
 
                 if not ifnotexists:
                     raise
@@ -677,7 +676,7 @@
                     values ('TYPE', :1)
                     """, (self._db_type(),)
                 )
-            except pgdb.DatabaseError:
+            except postgres.DatabaseError:
                 pass
 
 

Modified: CalendarServer/branches/users/wsanchez/psycopg2cffi/twistedcaldav/directory/test/test_proxyprincipaldb.py
===================================================================
--- CalendarServer/branches/users/wsanchez/psycopg2cffi/twistedcaldav/directory/test/test_proxyprincipaldb.py	2015-02-18 19:31:43 UTC (rev 14426)
+++ CalendarServer/branches/users/wsanchez/psycopg2cffi/twistedcaldav/directory/test/test_proxyprincipaldb.py	2015-02-18 21:12:36 UTC (rev 14427)
@@ -598,11 +598,11 @@
 
 
 try:
-    import pgdb
+    import psycopg2cffi as postgres
 except ImportError:
     ProxyPrincipalDBPostgreSQL.skip = True
 else:
     try:
-        db = pgdb.connect(host="localhost", database="proxies")
+        db = postgres.connect(host="localhost", database="proxies")
     except:
         ProxyPrincipalDBPostgreSQL.skip = True

Modified: CalendarServer/branches/users/wsanchez/psycopg2cffi/txdav/base/datastore/subpostgres.py
===================================================================
--- CalendarServer/branches/users/wsanchez/psycopg2cffi/txdav/base/datastore/subpostgres.py	2015-02-18 19:31:43 UTC (rev 14426)
+++ CalendarServer/branches/users/wsanchez/psycopg2cffi/txdav/base/datastore/subpostgres.py	2015-02-18 21:12:36 UTC (rev 14427)
@@ -26,7 +26,7 @@
 from hashlib import md5
 from pipes import quote as shell_quote
 
-import pgdb
+import psycopg2cffi as postgres
 
 from twisted.python.procutils import which
 from twisted.internet.protocol import ProcessProtocol
@@ -331,7 +331,7 @@
         if self.port:
             kwargs["host"] = "{}:{}".format(self.host, self.port)
 
-        return DBAPIConnector(pgdb, postgresPreflight, dsn, **kwargs)
+        return DBAPIConnector(postgres, postgresPreflight, dsn, **kwargs)
 
 
     def produceConnection(self, label="<unlabeled>", databaseName=None):
@@ -353,7 +353,7 @@
                 createDatabaseCursor.execute(
                     "drop database {}".format(self.databaseName)
                 )
-            except pgdb.DatabaseError:
+            except postgres.DatabaseError:
                 pass
 
         try:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20150218/71ee1a73/attachment.html>


More information about the calendarserver-changes mailing list