Update of /cvsroot/webware/Webware/MiddleKit/Design
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12425
Modified Files:
PythonGenerator.py
Log Message:
For TimeAttr attributes, allow setting the attributes using DateTime instances
(not just DateTimeDelta instances). This is what comes from the database
for 'time' columns using PostgresSQL and the psycopg adapter.
Index: PythonGenerator.py
===================================================================
RCS file: /cvsroot/webware/Webware/MiddleKit/Design/PythonGenerator.py,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -d -r1.35 -r1.36
*** PythonGenerator.py 3 Apr 2004 02:52:50 -0000 1.35
--- PythonGenerator.py 16 Sep 2004 19:22:51 -0000 1.36
***************
*** 457,460 ****
--- 457,471 ----
return 'DateTimeDeltaType'
+ def writePySetChecks(self, out):
+ # additional check to also allow DateTime instances. This is what
+ # comes back from the database for 'time' columns using PostgresSQL
+ # and the psycopg adapter.
+ if DateTime:
+ out.write('''\
+ if type(value) is DateTime.DateTimeType:
+ value = DateTime.DateTimeDeltaFrom(value.time)
+ ''')
+ TimeAttr.mixInSuperWritePySetChecks(self, out)
+
class DateTimeAttr:
|