Update of /cvsroot/sqlobject/SQLObject/SQLObject
In directory sc8-pr-cvs1:/tmp/cvs-serv2335/SQLObject
Modified Files:
Col.py
Log Message:
Add `unique` keyword argument to Col. (need doc)
Index: Col.py
===================================================================
RCS file: /cvsroot/sqlobject/SQLObject/SQLObject/Col.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Col.py 9 Apr 2003 04:35:32 -0000 1.7
--- Col.py 10 Apr 2003 04:46:54 -0000 1.8
***************
*** 22,26 ****
foreignKey=None,
alternateID=False, alternateMethodName=None,
! constraints=None, notNull=False):
# This isn't strictly true, since we *could* use backquotes
# around column names, but why would anyone *want* to
--- 22,27 ----
foreignKey=None,
alternateID=False, alternateMethodName=None,
! constraints=None, notNull=False,
! unique=NoDefault):
# This isn't strictly true, since we *could* use backquotes
# around column names, but why would anyone *want* to
***************
*** 62,65 ****
--- 63,70 ----
constraints = [Constraints.notNull] + constraints
self.contraints = constraints
+ if unique is NoDefault:
+ self.unique = alternateID
+ else:
+ self.unique = unique
def autoConstraints(self):
***************
*** 109,113 ****
if self.notNull:
result.append('NOT NULL')
! if self.alternateID:
result.append('UNIQUE')
return result
--- 114,118 ----
if self.notNull:
result.append('NOT NULL')
! if self.unique:
result.append('UNIQUE')
return result
|