Author: ianb
Date: 2005-07-21 05:56:44 +0000 (Thu, 21 Jul 2005)
New Revision: 846
Modified:
trunk/SQLObject/sqlobject/main.py
Log:
Moved idType to sqlmeta
Modified: trunk/SQLObject/sqlobject/main.py
===================================================================
--- trunk/SQLObject/sqlobject/main.py 2005-07-20 15:00:52 UTC (rev 845)
+++ trunk/SQLObject/sqlobject/main.py 2005-07-21 05:56:44 UTC (rev 846)
@@ -150,6 +150,10 @@
table = None
idName = None
+ # This function is used to coerce IDs into the proper format,
+ # so you should replace it with str, or another function, if you
+ # aren't using integer IDs
+ idType = int
style = None
lazyUpdate = False
defaultOrder = None
@@ -285,11 +289,6 @@
# when necessary: (bad clever? maybe)
_expired = False
- # This function is used to coerce IDs into the proper format,
- # so you should replace it with str, or another function, if you
- # aren't using integer IDs
- _idType = int
-
sqlmeta = sqlmeta
#DSM: The _inheritable attribute controls wheter the class can by
@@ -506,6 +505,7 @@
_defaultOrder = _sqlmeta_attr('defaultOrder', 2)
_cacheValues = _sqlmeta_attr('cacheValues', 2)
_registry = _sqlmeta_attr('registry', 2)
+ _idType = _sqlmeta_attr('idType', 2)
def _cleanDeprecatedAttrs(cls, new_attrs):
for attr in ['_table', '_lazyUpdate', '_style', '_idName',
@@ -525,7 +525,7 @@
assert id is not None, 'None is not a possible id for %s' % cls.__name__
- id = cls._idType(id)
+ id = cls.sqlmeta.idType(id)
if connection is None:
cache = cls._connection.cache
@@ -1059,7 +1059,7 @@
self._SO_writeLock = threading.Lock()
if kw.has_key('id'):
- id = self._idType(kw['id'])
+ id = self.sqlmeta.idType(kw['id'])
del kw['id']
else:
id = None
@@ -1356,7 +1356,7 @@
if isinstance(value, cls):
return value.id
else:
- return cls._idType(value)
+ return cls.sqlmeta.idType(value)
coerceID = classmethod(coerceID)
|