[SQL-CVS] SQLObject/SQLObject Col.py,1.12,1.13
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: <ian...@us...> - 2003-04-21 07:40:30
|
Update of /cvsroot/sqlobject/SQLObject/SQLObject In directory sc8-pr-cvs1:/tmp/cvs-serv21201a/SQLObject Modified Files: Col.py Log Message: * Added Decimal and Currency Col * Fixed bug with using SQLBuilder const's as defaults to Col objects Index: Col.py =================================================================== RCS file: /cvsroot/sqlobject/SQLObject/SQLObject/Col.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Col.py 19 Apr 2003 00:54:25 -0000 1.12 --- Col.py 21 Apr 2003 07:40:26 -0000 1.13 *************** *** 84,87 **** --- 84,89 ---- if self._default is NoDefault: return NoDefault + elif hasattr(self._default, 'sqlRepr'): + return self._default elif callable(self._default): return self._default() *************** *** 242,245 **** --- 244,261 ---- return 'TIMESTAMP' + class DecimalCol(Col): + + def __init__(self, name, size, precision, **kw): + self.size = size + self.precision = precision + Col.__init__(self, name, **kw) + + def _sqlType(self): + return 'DECIMAL(%i, %i)' % (self.size, self.precision) + + class CurrencyCol(DecimalCol): + + def __init__(self, name, **kw): + DecimalCol.__init__(self, name, size=10, precision=2, **kw) |