[TransWarp] peak.storage patch
Radek Kanovsky
rk at dat.cz
Mon Jun 23 15:51:10 EDT 2003
Hi,
this patch solves problem with infinite recursion (discussed on IRC)
when binding to SQL URLs and additionaly allows connect to PostgreSQL
server via UNIX domain socket on some machines. URLs should look like this
'pgsql:///dbname'. Notice that server part between '//' and third '/'
is empty. I think that this solution can be safely used with other SQL
servers.
Radek Kanovsky
diff -ru /home/radekk/work/PEAK/src/peak/peak.ini ./peak.ini
--- /home/radekk/work/PEAK/src/peak/peak.ini 2003-06-19 18:48:28.000000000 +0200
+++ ./peak.ini 2003-06-23 21:23:23.000000000 +0200
@@ -94,7 +94,7 @@
ldap = "peak.storage.LDAP:ldapURL"
sybase = "peak.storage.SQL:GenericSQL_URL"
-pgsql = "peak.storage.SQL:GenericSQL_URL"
+pgsql = "peak.storage.SQL:PostgresSQL_URL"
gadfly = "peak.storage.SQL:GadflyURL"
logfile = "peak.running.logs:logfileURL"
logging.logger = "peak.running.logs:peakLoggerContext"
diff -ru /home/radekk/work/PEAK/src/peak/storage/SQL.py ./storage/SQL.py
--- /home/radekk/work/PEAK/src/peak/storage/SQL.py 2003-06-23 21:01:59.000000000 +0200
+++ ./storage/SQL.py 2003-06-23 21:36:18.000000000 +0200
@@ -492,7 +492,7 @@
class GenericSQL_URL(naming.URL.Base):
- supportedSchemes = ('sybase', 'pgsql')
+ supportedSchemes = ('sybase',)
class user(naming.URL.Field):
pass
@@ -510,6 +510,26 @@
('//',), (user, (':', passwd), '@'), server, ('/', db)
)
+class PostgresSQL_URL(GenericSQL_URL) :
+
+ supportedSchemes = ('pgsql',)
+
+ class user(naming.URL.Field):
+ pass
+
+ class passwd(naming.URL.Field):
+ pass
+
+ class server(naming.URL.Field):
+ pass
+
+ class db(naming.URL.Field):
+ pass
+
+ syntax = naming.URL.Sequence(
+ ('//',), (user, (':', passwd), '@'), (server,), ('/', db)
+ )
+
drivers = {
'sybase': SybaseConnection,
'pgsql': PGSQLConnection,
diff -ru /home/radekk/work/PEAK/src/peak/storage/connections.py ./storage/connections.py
--- /home/radekk/work/PEAK/src/peak/storage/connections.py 2003-05-17 11:15:31.000000000 +0200
+++ ./storage/connections.py 2003-06-23 21:13:10.000000000 +0200
@@ -229,7 +229,8 @@
cursorClass = AbstractCursor
address = binding.requireBinding(
- "Address used to create the actual connection"
+ "Address used to create the actual connection",
+ suggestParent=False
)
More information about the PEAK
mailing list