Author: phd
Date: 2007-03-28 10:21:54 -0600 (Wed, 28 Mar 2007)
New Revision: 2466
Modified:
SQLObject/branches/sqlbuilder-views/sqlobject/dbconnection.py
SQLObject/branches/sqlbuilder-views/sqlobject/inheritance/__init__.py
SQLObject/branches/sqlbuilder-views/sqlobject/sqlbuilder.py
SQLObject/branches/sqlbuilder-views/sqlobject/sresults.py
Log:
Removed trailing spaces.
Modified: SQLObject/branches/sqlbuilder-views/sqlobject/dbconnection.py
===================================================================
--- SQLObject/branches/sqlbuilder-views/sqlobject/dbconnection.py 2007-03-28 16:20:42 UTC (rev 2465)
+++ SQLObject/branches/sqlbuilder-views/sqlobject/dbconnection.py 2007-03-28 16:21:54 UTC (rev 2466)
@@ -435,7 +435,7 @@
if isinstance(tableCreateSQLs, tuple):
tableCreateSQLs = list(tableCreateSQLs)
assert isinstance(tableCreateSQLs,list), (
- 'Unable to create a list from %s.sqlmeta.createSQL' %
+ 'Unable to create a list from %s.sqlmeta.createSQL' %
(soClass.__name__))
return tableCreateSQLs or []
Modified: SQLObject/branches/sqlbuilder-views/sqlobject/inheritance/__init__.py
===================================================================
--- SQLObject/branches/sqlbuilder-views/sqlobject/inheritance/__init__.py 2007-03-28 16:20:42 UTC (rev 2465)
+++ SQLObject/branches/sqlbuilder-views/sqlobject/inheritance/__init__.py 2007-03-28 16:21:54 UTC (rev 2466)
@@ -32,9 +32,9 @@
inheritedTables=None, **ops):
if clause is None or isinstance(clause, str) and clause == 'all':
clause = sqlbuilder.SQLTrueClause
-
+
dbName = (ops.get('connection',None) or sourceClass._connection).dbName
-
+
tablesDict = tablesUsedDict(clause, dbName)
tablesDict[sourceClass.sqlmeta.table] = 1
orderBy = ops.get('orderBy')
Modified: SQLObject/branches/sqlbuilder-views/sqlobject/sqlbuilder.py
===================================================================
--- SQLObject/branches/sqlbuilder-views/sqlobject/sqlbuilder.py 2007-03-28 16:20:42 UTC (rev 2465)
+++ SQLObject/branches/sqlbuilder-views/sqlobject/sqlbuilder.py 2007-03-28 16:21:54 UTC (rev 2466)
@@ -79,7 +79,7 @@
safeSQLRE = re.compile(r'^[a-zA-Z_][a-zA-Z0-9_\.]*$')
def sqlIdentifier(obj):
- # some db drivers return unicode column names
+ # some db drivers return unicode column names
return isinstance(obj, types.StringTypes) and bool(safeSQLRE.search(obj.strip()))
@@ -418,7 +418,7 @@
if isinstance(fieldName, SQLExpression):
fieldName = sqlrepr(fieldName, db)
return self.alias + "." + fieldName
-
+
def tablesUsedImmediate(self):
return [self.aliasTable]
@@ -456,7 +456,7 @@
if self.table:
attr = getattr(self.table.q, attr).fieldName
return self.FieldClass(self.tableName, attr, self.alias, self)
-
+
def __sqlrepr__(self, db):
return "%s %s %s" % (sqlrepr(self.tableName, db), self.as_string, self.alias)
@@ -485,7 +485,7 @@
t = SQLConstant(t.sqlmeta.table)
tabs.append(t)
self.tables = tabs
-
+
def __sqlrepr__(self, db):
return " UNION ".join([str(sqlrepr(t, db)) for t in self.tables])
@@ -521,7 +521,7 @@
self.ops['reversed'] = reversed
self.ops['forUpdate'] = forUpdate
self.ops['staticTables'] = staticTables
-
+
def clone(self, **newOps):
ops = self.ops.copy()
ops.update(newOps)
@@ -558,7 +558,7 @@
clause = self.ops['clause']
if isinstance(clause, (str, unicode)):
clause = SQLConstant('(%s)' % clause)
-
+
if clause == SQLTrueClause:
newClause = filter_clause
else:
@@ -566,7 +566,7 @@
return self.newClause(newClause)
def __sqlrepr__(self, db):
-
+
select = "SELECT"
if self.ops['distinct']:
select += " DISTINCT"
@@ -1182,7 +1182,7 @@
def __init__(self, proxy, attr):
self.attr = attr
self.proxy = proxy
-
+
def __sqlrepr__(self, db):
if self.proxy.soClass is None:
return '_DELAYED_' + self.attr
@@ -1193,13 +1193,13 @@
def tablesUsedImmediate(self):
return getattr(self._resolve(), 'tablesUsedImmediate', lambda: [])()
-
+
def components(self):
return getattr(self._resolve(), 'components', lambda: [])()
def _resolve(self):
return getattr(self.proxy, self.attr)
-
+
# For AliasTable etc
def fieldName(self):
class _aliasFieldName(SQLExpression):
@@ -1212,7 +1212,7 @@
class _DelayClass(_Delay):
def _resolve(self):
- return self.proxy.soClass.sqlmeta.table
+ return self.proxy.soClass.sqlmeta.table
class _Delay_proxy(object):
def __init__(self, **kw):
Modified: SQLObject/branches/sqlbuilder-views/sqlobject/sresults.py
===================================================================
--- SQLObject/branches/sqlbuilder-views/sqlobject/sresults.py 2007-03-28 16:20:42 UTC (rev 2465)
+++ SQLObject/branches/sqlbuilder-views/sqlobject/sresults.py 2007-03-28 16:21:54 UTC (rev 2466)
@@ -27,7 +27,7 @@
self.ops['dbOrderBy'] = orderBy
if ops.has_key('connection') and ops['connection'] is None:
del ops['connection']
-
+
tablesDict = sqlbuilder.tablesUsedDict(self.clause, self._getConnection().dbName)
if clauseTables:
for table in clauseTables:
@@ -292,7 +292,7 @@
def _throughTo(self, attr):
otherClass = None
orderBy = sqlbuilder.NoDefault
-
+
ref = self.sourceClass.sqlmeta.columns.get(attr.endswith('ID') and attr or attr+'ID', None)
if ref and ref.foreignKey:
otherClass, clause = self._throughToFK(ref)
@@ -305,27 +305,27 @@
otherClass, clause = self._throughToRelatedJoin(join)
else:
otherClass, clause = self._throughToMultipleJoin(join)
-
+
if not otherClass:
raise AttributeError("throughTo argument (got %s) should be name of foreignKey or SQL*Join in %s" % (attr, self.sourceClass))
-
+
return otherClass.select(clause,
distinct=True,
orderBy=orderBy,
connection=self._getConnection())
-
+
def _throughToFK(self, col):
otherClass = getattr(self.sourceClass, "_SO_class_"+col.foreignKey)
query = sqlbuilder.Alias(self.queryForSelect(), "%s_%s" % (self.sourceClass.__name__, col.name))
return otherClass, otherClass.q.id==getattr(query.q, getattr(self.sourceClass.q, col.name).fieldName)
-
+
def _throughToMultipleJoin(self, join):
otherClass = join.otherClass
query = self.queryForSelect()
query = sqlbuilder.Alias(query, "%s_%s" % (self.sourceClass.__name__, join.joinMethodName))
joinColumn = getattr(otherClass.q, join.soClass.sqlmeta.style.dbColumnToPythonAttr(join.joinColumn))
return otherClass, joinColumn==getattr(query.q, self.sourceClass.q.id.fieldName)
-
+
def _throughToRelatedJoin(self, join):
otherClass = join.otherClass
intTable = sqlbuilder.Table(join.intermediateTable)
@@ -335,5 +335,4 @@
getattr(intTable, join.joinColumn) == getattr(query.q, join.joinColumn))
return otherClass, clause
-
__all__ = ['SelectResults']
|