Author: ianb
Date: 2006-01-25 22:48:59 -0700 (Wed, 25 Jan 2006)
New Revision: 1539
Modified:
SQLObject/trunk/sqlobject/main.py
Log:
Make sure that sqlmeta always gets set to an instance when a SQLObject instance is created; sometimes they would be left as the class which is common to all SQLObject/subclass instances. This could potentially have caused a lot of problems.
Modified: SQLObject/trunk/sqlobject/main.py
===================================================================
--- SQLObject/trunk/sqlobject/main.py 2006-01-26 05:46:09 UTC (rev 1538)
+++ SQLObject/trunk/sqlobject/main.py 2006-01-26 05:48:59 UTC (rev 1539)
@@ -944,10 +944,6 @@
# created, unlike __init__ which would be called
# anytime the object was returned from cache.
self.id = id
- # We shadow the sqlmeta class with an instance of sqlmeta
- # that points to us (our sqlmeta buddy object; where the
- # sqlmeta class is our class's buddy class)
- self.sqlmeta = self.__class__.sqlmeta(self)
self._SO_writeLock = threading.Lock()
# If no connection was given, we'll inherit the class
@@ -1193,14 +1189,16 @@
return joinClass.get(id)
def __init__(self, **kw):
+ # We shadow the sqlmeta class with an instance of sqlmeta
+ # that points to us (our sqlmeta buddy object; where the
+ # sqlmeta class is our class's buddy class)
+ self.sqlmeta = self.__class__.sqlmeta(self)
# The get() classmethod/constructor uses a magic keyword
# argument when it wants an empty object, fetched from the
# database. So we have nothing more to do in that case:
if kw.has_key('_SO_fetch_no_create'):
return
- self.sqlmeta = self.__class__.sqlmeta(self)
-
post_funcs = []
self.sqlmeta.send(events.RowCreateSignal, kw, post_funcs)
|