Thread: [SQL-CVS] r2437 - SQLObject/trunk/sqlobject
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: <sub...@co...> - 2007-03-20 15:24:57
|
Author: phd Date: 2007-03-20 09:24:41 -0600 (Tue, 20 Mar 2007) New Revision: 2437 Modified: SQLObject/trunk/sqlobject/main.py Log: SQLObject.tableExists() as a shortcut for conn.tableExists(cls.sqlmeta.table). Modified: SQLObject/trunk/sqlobject/main.py =================================================================== --- SQLObject/trunk/sqlobject/main.py 2007-03-19 23:07:33 UTC (rev 2436) +++ SQLObject/trunk/sqlobject/main.py 2007-03-20 15:24:41 UTC (rev 2437) @@ -1346,10 +1346,16 @@ selectBy = classmethod(selectBy) + def tableExists(cls, connection=None): + conn = connection or cls._connection + return conn.tableExists(cls.sqlmeta.table) + + tableExists = classmethod(tableExists) + def dropTable(cls, ifExists=False, dropJoinTables=True, cascade=False, connection=None): conn = connection or cls._connection - if ifExists and not conn.tableExists(cls.sqlmeta.table): + if ifExists and not cls.tableExists(connection=conn): return extra_sql = [] post_funcs = [] @@ -1368,7 +1374,7 @@ createIndexes=True, applyConstraints=True, connection=None): conn = connection or cls._connection - if ifNotExists and conn.tableExists(cls.sqlmeta.table): + if ifNotExists and cls.tableExists(connection=conn): return extra_sql = [] post_funcs = [] |