Update of /cvsroot/sqlobject/SQLObject/SQLObject
In directory sc8-pr-cvs1:/tmp/cvs-serv11660/SQLObject
Modified Files:
SQLObject.py
Log Message:
Made SomeSQLObject(None) bomb instead of just acting weird.
Index: SQLObject.py
===================================================================
RCS file: /cvsroot/sqlobject/SQLObject/SQLObject/SQLObject.py,v
retrieving revision 1.44
retrieving revision 1.45
diff -C2 -d -r1.44 -r1.45
*** SQLObject.py 31 May 2003 02:00:39 -0000 1.44
--- SQLObject.py 4 Jun 2003 05:20:05 -0000 1.45
***************
*** 323,326 ****
--- 323,329 ----
+ class CreateNewSQLObject:
+ pass
+
# SQLObject is the superclass for all SQLObject classes, of
# course. All the deeper magic is done in MetaSQLObject, and
***************
*** 370,377 ****
def __new__(cls, id, connection=None, selectResults=None):
# When id is None, that means we are trying
# to create a new object. This is done by the
# `new()` method.
! if id is None:
# Create an actual new object:
inst = object.__new__(cls)
--- 373,382 ----
def __new__(cls, id, connection=None, selectResults=None):
+ assert id is not None, 'None is not a possible id for %s' % cls.__name
+
# When id is None, that means we are trying
# to create a new object. This is done by the
# `new()` method.
! if id is CreateNewSQLObject:
# Create an actual new object:
inst = object.__new__(cls)
***************
*** 743,750 ****
# a new object.
if kw.has_key('connection'):
! inst = cls(None, connection=kw['connection'])
del kw['connection']
else:
! inst = cls(None)
# First we do a little fix-up on the keywords we were
--- 748,755 ----
# a new object.
if kw.has_key('connection'):
! inst = cls(CreateNewSQLObject, connection=kw['connection'])
del kw['connection']
else:
! inst = cls(CreateNewSQLObject)
# First we do a little fix-up on the keywords we were
|