[Zope-CVS] CVS: Products/Ape/lib/apelib/sql - classification.py:1.8 dbapi.py:1.7 interfaces.py:1.3 oidgen.py:1.4 properties.py:1.8 security.py:1.7 sqlbase.py:1.12 structure.py:1.11

Shane Hathaway shane at zope.com
Sat Mar 20 01:34:54 EST 2004


Update of /cvs-repository/Products/Ape/lib/apelib/sql
In directory cvs.zope.org:/tmp/cvs-serv19743/lib/apelib/sql

Modified Files:
	classification.py dbapi.py interfaces.py oidgen.py 
	properties.py security.py sqlbase.py structure.py 
Log Message:
Converted method and function names to conform with PEP 8.

PEP 8 (or perhaps the next revision) recommends 
lowercase_with_underscores over mixedCase.  Since everything is being 
renamed for this release anyway, why not throw in this too? :-)

Also got SQLMultiTableProperties back into shape.



=== Products/Ape/lib/apelib/sql/classification.py 1.7 => 1.8 ===
--- Products/Ape/lib/apelib/sql/classification.py:1.7	Thu Mar 11 00:58:38 2004
+++ Products/Ape/lib/apelib/sql/classification.py	Sat Mar 20 01:34:23 2004
@@ -33,7 +33,7 @@
         )
 
     def load(self, event):
-        conn = self.getConnection(event)
+        conn = self.get_connection(event)
         rows = conn.select(self.table, self.columns, oid=event.oid)
         classification = {}
         if rows:
@@ -47,11 +47,11 @@
         return classification, rec
 
     def store(self, event, classification):
-        conn = self.getConnection(event)
+        conn = self.get_connection(event)
         row = (classification.get('class_name', ''),
                classification.get('mapper_name', ''))
         try:
-            conn.setOne(self.table, event.oid, self.columns, row, event.is_new)
+            conn.set_one(self.table, event.oid, self.columns, row, event.is_new)
         except conn.module.IntegrityError:
             raise OIDConflictError(event.oid)
         return row


=== Products/Ape/lib/apelib/sql/dbapi.py 1.6 => 1.7 ===
--- Products/Ape/lib/apelib/sql/dbapi.py:1.6	Fri Mar 19 23:24:29 2004
+++ Products/Ape/lib/apelib/sql/dbapi.py	Sat Mar 20 01:34:23 2004
@@ -50,49 +50,49 @@
         return '<%s(%s(%s))>' % (
             self.__class__.__name__, self.module_name, self.connect_args)
 
-    def translateName(self, column_name):
+    def translate_name(self, column_name):
         """Returns a column name for a variable name.
 
         Defaults to no translation.
         """
         return self.column_name_translations.get(column_name, column_name)
 
-    def translateType(self, column_type):
+    def translate_type(self, column_type):
         """Returns a database type for a variable type.
 
         If the type is unknown, raises KeyError.
         """
         return self.column_type_translations.get(column_type, column_type)
 
-    def generateConditions(self, keys):
+    def generate_conditions(self, keys):
         conditions = []
         for key in keys:
-            clause = "%s = :%s" % (self.translateName(key), key)
+            clause = "%s = :%s" % (self.translate_name(key), key)
             conditions.append(clause)
         return ' AND '.join(conditions)
 
-    def generateInsert(self, table_name, columns):
-        dbcols = [self.translateName(col) for col in columns]
+    def generate_insert(self, table_name, columns):
+        dbcols = [self.translate_name(col) for col in columns]
         colfmts = [':%s' % col for col in columns]
         return 'INSERT INTO %s (%s) VALUES (%s)' % (
             table_name, ', '.join(dbcols), ', '.join(colfmts))
 
-    def generateUpdate(self, table_name, key_columns, other_columns):
-        where = self.generateConditions(key_columns)
+    def generate_update(self, table_name, key_columns, other_columns):
+        where = self.generate_conditions(key_columns)
         to_set = [
-            ("%s = :%s" % (self.translateName(col), col))
+            ("%s = :%s" % (self.translate_name(col), col))
             for col in other_columns]
         return 'UPDATE %s SET %s WHERE %s' % (
             table_name, ', '.join(to_set), where)
 
-    def generateDelete(self, table_name, keys):
-        where = self.generateConditions(keys)
+    def generate_delete(self, table_name, keys):
+        where = self.generate_conditions(keys)
         sql = 'DELETE FROM %s' % table_name
         if where:
             sql += ' WHERE %s' % where
         return sql
 
-    def makeDict(self, columns, data, oid=None):
+    def make_dict(self, columns, data, oid=None):
         res = {}
         for n in range(len(columns)):
             res[columns[n]] = data[n]
@@ -108,13 +108,13 @@
         """Selects rows from a table and returns column values for those rows.
         """
         table_name = self.prefix + table
-        dbcols = [self.translateName(col) for col in result_columns]
-        where = self.generateConditions(filter.keys())
+        dbcols = [self.translate_name(col) for col in result_columns]
+        where = self.generate_conditions(filter.keys())
         sql = 'SELECT %s FROM %s WHERE %s' % (
             ', '.join(dbcols), table_name, where)
         return self.execute(sql, filter, fetch=1)
 
-    def setOne(self, table, oid, columns, row, is_new):
+    def set_one(self, table, oid, columns, row, is_new):
         """Sets one row in a table.
 
         Requires the table to have only one value for each oid.
@@ -122,15 +122,15 @@
         the is_new argument and configured policies.
         """
         table_name = self.prefix + table
-        kw = self.makeDict(columns, row, oid)
+        kw = self.make_dict(columns, row, oid)
         if is_new:
-            sql = self.generateInsert(table_name, ('oid',) + tuple(columns))
+            sql = self.generate_insert(table_name, ('oid',) + tuple(columns))
             self.execute(sql, kw)
         else:
-            sql = self.generateUpdate(table_name, ('oid',), columns)
+            sql = self.generate_update(table_name, ('oid',), columns)
             self.execute(sql, kw)
             
-    def setMany(self, table, oid, key_columns, other_columns, rows):
+    def set_many(self, table, oid, key_columns, other_columns, rows):
         """Sets multiple rows in a table.
 
         'rows' is a sequence of tuples containing values for the
@@ -144,11 +144,11 @@
         combo = tuple(key_columns) + tuple(other_columns)
         if not key_columns:
             # Don't compare rows.  Just delete and insert.
-            sql = self.generateDelete(table_name, ('oid',))
+            sql = self.generate_delete(table_name, ('oid',))
             self.execute(sql, {'oid': oid})
             for row in rows:
-                sql = self.generateInsert(table_name, ('oid',) + combo)
-                kw = self.makeDict(combo, row, oid)
+                sql = self.generate_insert(table_name, ('oid',) + combo)
+                kw = self.make_dict(combo, row, oid)
                 self.execute(sql, kw)
             return
         # Edit the table.
@@ -168,30 +168,30 @@
         for key, value in existing.items():
             if not now.has_key(key):
                 # Delete this row.
-                sql = self.generateDelete(
+                sql = self.generate_delete(
                     table_name, ('oid',) + tuple(key_columns))
-                kw = self.makeDict(key_columns, key, oid)
+                kw = self.make_dict(key_columns, key, oid)
                 self.execute(sql, kw)
             elif now[key] != value:
                 # Update this row.
                 #print 'DIFFERENT:', now[key], value
-                sql = self.generateUpdate(
+                sql = self.generate_update(
                     table_name, ('oid',) + tuple(key_columns), other_columns)
-                kw = self.makeDict(combo, key + now[key], oid)
+                kw = self.make_dict(combo, key + now[key], oid)
                 self.execute(sql, kw)
         for key, value in now.items():
             if not existing.has_key(key):
                 # Insert this row.
-                sql = self.generateInsert(table_name, ('oid',) + combo)
-                kw = self.makeDict(combo, key + value, oid)
+                sql = self.generate_insert(table_name, ('oid',) + combo)
+                kw = self.make_dict(combo, key + value, oid)
                 self.execute(sql, kw)
         return
 
-    def deleteFrom(self, table, **filter):
+    def delete_from(self, table, **filter):
         """Deletes rows from a table.
         """
         table_name = self.prefix + table
-        sql = self.generateDelete(table_name, filter.keys())
+        sql = self.generate_delete(table_name, filter.keys())
         self.execute(sql, filter)
 
     def exists(self, name, type_name):
@@ -201,15 +201,20 @@
         """
         raise NotImplementedError("Abstract Method")
 
-    def createTable(self, table, column_defs):
+    def list_table_names(self):
+        """Returns a list of existing table names.
+        """
+        raise NotImplementedError("Abstract Method")
+
+    def create_table(self, table, column_defs):
         """Creates a table.
         """
         table_name = self.prefix + table
         cols = []
         pkeys = []
         for name, typ, unique in column_defs:
-            col = self.translateName(name)
-            db_type = self.translateType(typ)
+            col = self.translate_name(name)
+            db_type = self.translate_type(typ)
             cols.append("%s %s" % (col, db_type))
             if unique:
                 pkeys.append(col)
@@ -218,12 +223,12 @@
         sql = "CREATE TABLE %s (%s)" % (table_name, ', '.join(cols))
         self.execute(sql)
 
-    def createSequence(self, name, start=1):
+    def create_sequence(self, name, start=1):
         """Creates a sequence.
         """
         raise NotImplementedError("Abstract Method")
 
-    def resetSequence(self, name, start=1):
+    def reset_sequence(self, name, start=1):
         """Resets a sequence.
         """
         raise NotImplementedError("Abstract Method")
@@ -391,13 +396,24 @@
         rows = self.execute(sql, {'name': table_name}, fetch=1)
         return len(rows)
 
-    def createSequence(self, name, start=1):
+    def list_table_names(self):
+        """Returns a list of existing table names.
+        """
+        sql = 'SELECT tablename FROM pg_tables'
+        rows = self.execute(sql, {}, fetch=1)
+        res = []
+        for (name,) in rows:
+            if not self.prefix or name.startswith(self.prefix):
+                res.append(name[len(self.prefix):])
+        return res
+
+    def create_sequence(self, name, start=1):
         """Creates a sequence.
         """
         sql = "CREATE SEQUENCE %s START %d" % (self.prefix + name, start)
         self.execute(sql)
 
-    def resetSequence(self, name, start=1):
+    def reset_sequence(self, name, start=1):
         """Resets a sequence.
         """
         sql = "SELECT setval('%s', %d)" % (self.prefix + name, start)
@@ -419,6 +435,7 @@
         'string': 'character varying(255)',
         'blob':   'longblob',
         'date_international': 'date',
+        'boolean': 'tinyint(1)',
         }
 
     column_name_translations = {
@@ -437,14 +454,25 @@
         rows = self.execute(sql, {'name': table_name}, fetch=1)
         return len(rows)
 
-    def createSequence(self, name, start=1):
+    def list_table_names(self):
+        """Returns a list of existing table names.
+        """
+        sql = 'SHOW TABLES'
+        rows = self.execute(sql, {}, fetch=1)
+        res = []
+        for (name,) in rows:
+            if not self.prefix or name.startswith(self.prefix):
+                res.append(name[len(self.prefix):])
+        return res
+
+    def create_sequence(self, name, start=1):
         """Creates a sequence.
         """
         table_name = self.prefix + name
         self.execute("CREATE TABLE %s (last_value int)" % table_name)
         self.execute("INSERT INTO %s VALUES (%d)" % (table_name, start))
 
-    def resetSequence(self, name, start=1):
+    def reset_sequence(self, name, start=1):
         """Resets a sequence.
         """
         table_name = self.prefix + name


=== Products/Ape/lib/apelib/sql/interfaces.py 1.2 => 1.3 ===
--- Products/Ape/lib/apelib/sql/interfaces.py:1.2	Thu Mar 11 00:58:38 2004
+++ Products/Ape/lib/apelib/sql/interfaces.py	Sat Mar 20 01:34:23 2004
@@ -33,14 +33,14 @@
         """Selects rows from a table and returns column values for those rows.
         """
 
-    def setOne(table, oid, columns, row, is_new):
+    def set_one(table, oid, columns, row, is_new):
         """Sets one row in a table.
 
         Executes either an update or insert operation, depending
         on the is_new argument and configured policies.
         """
 
-    def setMany(table, oid, key_columns, other_columns, rows):
+    def set_many(table, oid, key_columns, other_columns, rows):
         """Sets multiple rows in a table.
 
         'rows' is a sequence of tuples containing values for the
@@ -51,7 +51,7 @@
         pieces.
         """
 
-    def deleteFrom(table, **filter):
+    def delete_from(table, **filter):
         """Deletes rows from a table.
         """
 
@@ -62,17 +62,21 @@
         'sequence'.
         """
 
-    def createTable(name, column_defs):
+    def list_table_names():
+        """Returns a list of existing table names.
+        """
+
+    def create_table(name, column_defs):
         """Creates a table.
 
         column_defs is [(name, type, is_unique)].
         """
 
-    def createSequence(name, start=1):
+    def create_sequence(name, start=1):
         """Creates a sequence.
         """
 
-    def resetSequence(name, start=1):
+    def reset_sequence(name, start=1):
         """Resets a sequence to a starting value.
         """
 


=== Products/Ape/lib/apelib/sql/oidgen.py 1.3 => 1.4 ===
--- Products/Ape/lib/apelib/sql/oidgen.py:1.3	Thu Mar 11 00:58:38 2004
+++ Products/Ape/lib/apelib/sql/oidgen.py	Sat Mar 20 01:34:23 2004
@@ -31,11 +31,11 @@
     root_oid = "0"
 
     def init(self, event):
-        conn = self.getConnection(event)
+        conn = self.get_connection(event)
         if not conn.exists(self.table, 'sequence'):
-            conn.createSequence(self.table, start=1)
+            conn.create_sequence(self.table, start=1)
         elif event.clear_all:
-            conn.resetSequence(self.table, start=1)
+            conn.reset_sequence(self.table, start=1)
 
     def new_oid(self, event, name, stored):
         if not stored:
@@ -45,6 +45,6 @@
             # Request that the other side do the work (for ZEO)
             n = event.obj_db.new_oid()
         else:
-            conn = self.getConnection(event)
+            conn = self.get_connection(event)
             n = conn.increment(self.table)
         return str(n)


=== Products/Ape/lib/apelib/sql/properties.py 1.7 => 1.8 ===
--- Products/Ape/lib/apelib/sql/properties.py:1.7	Thu Mar 11 00:58:38 2004
+++ Products/Ape/lib/apelib/sql/properties.py	Sat Mar 20 01:34:23 2004
@@ -28,9 +28,9 @@
     __implements__ = SQLGatewayBase.__implements__
 
     schema = RowSequenceSchema()
-    schema.addField('id', 'string', 1)
-    schema.addField('type', 'string')
-    schema.addField('data', 'string')
+    schema.add('id', 'string', 1)
+    schema.add('type', 'string')
+    schema.add('data', 'string')
 
     table = 'properties'
     column_defs = (
@@ -40,15 +40,15 @@
         )
 
     def load(self, event):
-        conn = self.getConnection(event)
+        conn = self.get_connection(event)
         rows = conn.select(self.table, self.columns, oid=event.oid)
         rows.sort()
         return rows, tuple(rows)
 
     def store(self, event, state):
-        conn = self.getConnection(event)
+        conn = self.get_connection(event)
         rows = [(id, t, data) for id, t, data in state]
-        conn.setMany(self.table, event.oid, ('id',), ('type', 'data'), rows)
+        conn.set_many(self.table, event.oid, ('id',), ('type', 'data'), rows)
         state = list(state)
         state.sort()
         return tuple(state)
@@ -74,18 +74,18 @@
         SQLGatewayBase.__init__(self, conn_name)
 
 
-    def prepareTable(self, event):
+    def prepare_table(self, event):
         """Creates the fixed property table without triggering an error.
         """
         # Note: event is any kind of IGatewayEvent.
-        conn = self.getConnection(event)
+        conn = self.get_connection(event)
         if not conn.exists(self.table, 'table'):
             defs = (self.oid_column_def,) + self.column_defs
-            conn.createTable(self.table, defs)
+            conn.create_table(self.table, defs)
 
 
     def load(self, event):
-        conn = self.getConnection(event)
+        conn = self.get_connection(event)
         recs = conn.select(self.table, self.columns, oid=event.oid)
         if not recs:
             return (), ()
@@ -133,8 +133,8 @@
                 raise ValueError(
                     "Extra properties provided for fixed schema: %s"
                     % statedict.keys())
-        conn = self.getConnection(event)
-        conn.setOne(self.table, event.oid, self.columns, record, event.is_new)
+        conn = self.get_connection(event)
+        conn.set_one(self.table, event.oid, self.columns, record, event.is_new)
         return tuple(record)
 
 
@@ -146,32 +146,32 @@
     __implements__ = IGateway, IDatabaseInitializer
 
     schema = RowSequenceSchema()
-    schema.addField('id', 'string', 1)
-    schema.addField('type', 'string')
-    schema.addField('data', 'string')
+    schema.add('id', 'string', 1)
+    schema.add('type', 'string')
+    schema.add('data', 'string')
 
     def __init__(self, conn_name='db'):
         self.conn_name = conn_name
         self.var_props = SQLProperties(conn_name=conn_name)
         self.fixed_props = {}  # class name -> SQLFixedProperties instance
 
-    def getPollSources(self, event):
+    def get_sources(self, event):
         return None
 
     def init(self, event):
         self.var_props.init(event)
-        conn = self.getConnection(event)
+        conn = event.connections[self.conn_name]
         if event.clear_all:
             # Clear the fixed property tables by searching for tables
             # with a special name, 'fp_*'.
-            names = conn.listTableNames()
+            names = conn.list_table_names()
             for name in names:
                 if name.startswith('fp_'):
                     # This is a fixed property table.  Clear it.
-                    conn.delete(self.table_name)
+                    conn.delete_from(name)
 
 
-    def getColumnsForClass(self, module_name, class_name):
+    def get_columns_for_class(self, module_name, class_name):
         """Returns the class-defined property schema.
 
         This Zope2-ism should be made pluggable later on.
@@ -193,10 +193,10 @@
         return tuple(cols)
 
 
-    def getFixedProps(self, event):
+    def get_fixed_props(self, event):
         """Returns a SQLFixedProperties instance or None.
         """
-        classification = event.getClassification()
+        classification = event.classification
         if classification is None:
             return None
         cn = classification.get('class_name')
@@ -213,13 +213,13 @@
         # but databases like PostgreSQL truncate table names, so
         # we shouldn't put the module name in the table name.
         table_name = 'fp_%s' % class_name
-        cols = self.getColumnsForClass(module_name, class_name)
+        cols = self.get_columns_for_class(module_name, class_name)
         if not cols:
             # No fixed properties for this class.
             self.fixed_props[cn] = None
             return None
         fp = SQLFixedProperties(self.conn_name, table_name, cols)
-        fp.prepareTable(event)
+        fp.prepare_table(event)
         # XXX If the transaction gets aborted, the table creation will
         # be undone, but self.fixed_props won't see the change.
         # Perhaps we need to reset self.fixed_props on abort.
@@ -229,7 +229,7 @@
 
     def load(self, event):
         var_state, var_hash = self.var_props.load(event)
-        fp = self.getFixedProps(event)
+        fp = self.get_fixed_props(event)
         if fp is None:
             return var_state, var_hash
         fixed_state, fixed_hash = fp.load(event)
@@ -252,7 +252,7 @@
 
 
     def store(self, event, state):
-        fp = self.getFixedProps(event)
+        fp = self.get_fixed_props(event)
         if fp is None:
             return self.var_props.store(event, state)
         # Store the fixed state first and find out what got left over.


=== Products/Ape/lib/apelib/sql/security.py 1.6 => 1.7 ===
--- Products/Ape/lib/apelib/sql/security.py:1.6	Thu Mar 11 00:58:38 2004
+++ Products/Ape/lib/apelib/sql/security.py	Sat Mar 20 01:34:23 2004
@@ -26,23 +26,23 @@
     __implements__ = SQLGatewayBase.__implements__
 
     schema = RowSequenceSchema()
-    schema.addField('declaration_type', 'string')
-    schema.addField('role', 'string')
-    schema.addField('permission', 'string')
-    schema.addField('username', 'string')
+    schema.add('declaration_type', 'string')
+    schema.add('role', 'string')
+    schema.add('permission', 'string')
+    schema.add('username', 'string')
 
     table = 'security'
     oid_column_def = ('oid', 'int', 0)  # Don't create a primary key
 
     def load(self, event):
-        conn = self.getConnection(event)
+        conn = self.get_connection(event)
         items = conn.select(self.table, self.columns, oid=event.oid)
         items.sort()
         return items, tuple(items)
 
     def store(self, event, state):
-        conn = self.getConnection(event)
-        conn.setMany(self.table, event.oid, (), self.columns, state)
+        conn = self.get_connection(event)
+        conn.set_many(self.table, event.oid, (), self.columns, state)
         state = list(state)
         state.sort()
         return tuple(state)
@@ -55,10 +55,10 @@
     __implements__ = SQLGatewayBase.__implements__
 
     schema = RowSequenceSchema()
-    schema.addField('id', 'string', 1)
-    schema.addField('password', 'string')
-    schema.addField('roles', 'string:list')
-    schema.addField('domains', 'string:list')
+    schema.add('id', 'string', 1)
+    schema.add('password', 'string')
+    schema.add('roles', 'string:list')
+    schema.add('domains', 'string:list')
 
     table_defs = {
         'users':        (('oid', 'int', 1),
@@ -74,16 +74,16 @@
 
 
     def init(self, event):
-        conn = self.getConnection(event)
+        conn = self.get_connection(event)
         for table, col_defs in self.table_defs.items():
             if not conn.exists(table, 'table'):
-                conn.createTable(table, col_defs)
+                conn.create_table(table, col_defs)
             elif event.clear_all:
-                conn.deleteFrom(table)
+                conn.delete_from(table)
 
 
     def load(self, event):
-        conn = self.getConnection(event)
+        conn = self.get_connection(event)
         rows = conn.select('users', ('id', 'password'), oid=event.oid)
         data = {}
         for id, password in rows:
@@ -107,9 +107,9 @@
 
     def store(self, event, state):
         oid = event.oid
-        conn = self.getConnection(event)
+        conn = self.get_connection(event)
         rows = [(id, pw) for id, pw, roles, domains in state]
-        conn.setMany('users', event.oid, (), ('id', 'password',), rows)
+        conn.set_many('users', event.oid, (), ('id', 'password',), rows)
         roles_d = {}
         domains_d = {}
         for id, pw, roles, domains in state:
@@ -117,9 +117,9 @@
                 roles_d[(id, role)] = 1
             for domain in domains:
                 domains_d[(id, domain)] = 1
-        conn.setMany(
+        conn.set_many(
             'user_roles', event.oid, (), ('id', 'role',), roles_d.keys())
-        conn.setMany(
+        conn.set_many(
             'user_domains', event.oid, (), ('id', 'domain',), domains_d.keys())
         state = list(state)
         state.sort()


=== Products/Ape/lib/apelib/sql/sqlbase.py 1.11 => 1.12 ===
--- Products/Ape/lib/apelib/sql/sqlbase.py:1.11	Thu Mar 11 00:58:38 2004
+++ Products/Ape/lib/apelib/sql/sqlbase.py	Sat Mar 20 01:34:23 2004
@@ -33,21 +33,21 @@
     def __init__(self, conn_name='db'):
         self.conn_name = conn_name
         if self.column_defs is None and self.schema is not None:
-            self.column_defs = tuple(self.schema.getColumnDefs())
+            self.column_defs = tuple(self.schema.get_column_defs())
         self.columns = tuple([name for name, t, u in self.column_defs])
 
-    def getConnection(self, event):
+    def get_connection(self, event):
         return event.connections[self.conn_name]
 
     def init(self, event):
-        conn = self.getConnection(event)
+        conn = self.get_connection(event)
         assert IRDBMSConnection.isImplementedBy(conn)
         if conn.exists(self.table, 'table'):
             if event.clear_all:
-                conn.deleteFrom(self.table)
+                conn.delete_from(self.table)
         else:
             defs = (self.oid_column_def,) + self.column_defs
-            conn.createTable(self.table, defs)
+            conn.create_table(self.table, defs)
 
     def load(self, event):
         raise NotImplementedError, "abstract method"
@@ -55,5 +55,5 @@
     def store(self, event, obj):
         raise NotImplementedError, "abstract method"
 
-    def getPollSources(self, event):
+    def get_sources(self, event):
         return None


=== Products/Ape/lib/apelib/sql/structure.py 1.10 => 1.11 ===
--- Products/Ape/lib/apelib/sql/structure.py:1.10	Thu Mar 11 00:58:38 2004
+++ Products/Ape/lib/apelib/sql/structure.py	Sat Mar 20 01:34:23 2004
@@ -32,7 +32,7 @@
         )
 
     def load(self, event):
-        conn = self.getConnection(event)
+        conn = self.get_connection(event)
         firstcol = self.columns[:1]
         items = conn.select(self.table, firstcol, oid=event.oid)
         if items:
@@ -42,10 +42,10 @@
         return state, state
 
     def store(self, event, state):
-        conn = self.getConnection(event)
+        conn = self.get_connection(event)
         firstcol = (self.column_defs[0][0],)
         data = (conn.module.Binary(state),)
-        conn.setOne(self.table, event.oid, firstcol, data, event.is_new)
+        conn.set_one(self.table, event.oid, firstcol, data, event.is_new)
         return state
 
 
@@ -55,9 +55,9 @@
     __implements__ = SQLGatewayBase.__implements__
 
     schema = RowSequenceSchema()
-    schema.addField('key', 'string', 1)
-    schema.addField('oid', 'string')
-    schema.addField('classification', 'classification')
+    schema.add('key', 'string', 1)
+    schema.add('oid', 'string')
+    schema.add('classification', 'classification')
 
     table = 'folder_items'
     column_defs = (
@@ -66,7 +66,7 @@
         )
 
     def load(self, event):
-        conn = self.getConnection(event)
+        conn = self.get_connection(event)
         rows = conn.select(self.table, self.columns, oid=event.oid)
         res = []
         h = []
@@ -79,12 +79,12 @@
         return res, tuple(h)
 
     def store(self, event, state):
-        conn = self.getConnection(event)
+        conn = self.get_connection(event)
         rows = [(name, long(child_oid)) for (name, child_oid, cls) in state]
         rows.sort()
-        # Note that setMany() requires the child_oid column to match
+        # Note that set_many() requires the child_oid column to match
         # its database type.
-        conn.setMany(self.table, event.oid, ('name',), ('child_oid',), rows)
+        conn.set_many(self.table, event.oid, ('name',), ('child_oid',), rows)
         return tuple(rows)
 
 
@@ -109,7 +109,7 @@
         pass
 
     def load(self, event):
-        conn = self.getConnection(event)
+        conn = self.get_connection(event)
         rows = conn.select(self.table, ('name',), child_oid=event.oid)
         if len(rows) >= 1:
             name = rows[0][0]  # Accept only the first result
@@ -145,7 +145,7 @@
         )
 
     def load(self, event):
-        conn = self.getConnection(event)
+        conn = self.get_connection(event)
         items = conn.select(self.table, self.columns, oid=event.oid)
         if items:
             state = long(items[0][0])
@@ -155,9 +155,9 @@
 
     def store(self, event, state):
         state = long(state)
-        conn = self.getConnection(event)
+        conn = self.get_connection(event)
         data = (state,)
-        conn.setOne(self.table, event.oid, self.columns, data, event.is_new)
+        conn.set_one(self.table, event.oid, self.columns, data, event.is_new)
         return state
 
 




More information about the Zope-CVS mailing list