While looking at the postgres backends, I added some small cleanup patches to db backends which are not really bugs.

How do you want to deal with patches like these?
 - Should there always be a bug report?
 - Do you want patches for more or less cosmetic changes at all?

fs

diff -r bde1a821a377 trac/db/postgres_backend.py
--- a/trac/db/postgres_backend.py       Fri Jul 03 12:48:17 2009 +0200
+++ b/trac/db/postgres_backend.py       Fri Jul 03 12:55:12 2009 +0200
@@ -113,20 +113,21 @@
         scheme, db_prop = _parse_db_str(db_url)
         db_prop.setdefault('params', {})
         db_name = os.path.basename(db_prop['path'])
+        db_params = db_prop['params']
 
         args = [self.pg_dump_path, '-C', '-d', '-x', '-Z', '8']
         if 'user' in db_prop:
             args.extend(['-U', db_prop['user']])
-        if 'host' in db_prop['params']:
-            host = db_prop['params']['host']
+        if 'host' in db_params:
+            host = db_params['host']
         else:
             host = db_prop.get('host', 'localhost')
         args.extend(['-h', host])
         if '/' not in host:
             args.extend(['-p', str(db_prop.get('port', '5432'))])
 
-        if 'schema' in db_prop['params']:
-            args.extend(['-n', db_prop['params']['schema']])
+        if 'schema' in db_params:
+            args.extend(['-n', db_params['schema']])
 
         dest_file += ".gz"
         args.extend(['-f', dest_file, db_name])
diff -r 2ef2684e20df trac/db/sqlite_backend.py
--- a/trac/db/sqlite_backend.py Fri Jul 03 12:55:12 2009 +0200
+++ b/trac/db/sqlite_backend.py Fri Jul 03 13:57:34 2009 +0200
@@ -125,7 +125,7 @@
                                         ('pysqlite', self._version)])
         return SQLiteConnection(path, log, params)
 
-    def init_db(cls, path, log=None, params={}):
+    def init_db(self, path, log=None, params={}):
         if path != ':memory:':
             # make the directory to hold the database
             if os.path.exists(path):
@@ -137,11 +137,11 @@
         cursor = cnx.cursor()
         from trac.db_default import schema
         for table in schema:
-            for stmt in cls.to_sql(table):
+            for stmt in self.to_sql(table):
                 cursor.execute(stmt)
         cnx.commit()
 
-    def to_sql(cls, table):
+    def to_sql(self, table):
         return _to_sql(table)
 
     def backup(self, dest_file):

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to