[Modeling-cvs] ProjectModeling/Modeling Attribute.py,1.17,1.18
Status: Abandoned
Brought to you by:
sbigaret
From: <sbi...@us...> - 2003-08-30 17:22:59
|
Update of /cvsroot/modeling/ProjectModeling/Modeling In directory sc8-pr-cvs1:/tmp/cvs-serv14024/ProjectModeling/Modeling Modified Files: Attribute.py Log Message: date types: mxDateTime and/or DCOracle2's Date Index: Attribute.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/Attribute.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Attribute.py 23 Jul 2003 12:17:41 -0000 1.17 --- Attribute.py 30 Aug 2003 17:22:56 -0000 1.18 *************** *** 72,82 **** FieldIndex, KeywordIndex) def availableTypes(): #return ('string'(py2.1)/'str'(py2.2), 'int', 'float', 'tuple') ! return tuple([t.__name__ for t in (types.StringType, ! types.IntType, ! types.FloatType, ! #types.TupleType, ! DateTime)]) try: --- 72,97 ---- FieldIndex, KeywordIndex) + + + def date_types(): + "Returns the set of valid date types" + avail_types=[ type(DateTime(0)) ] + try: + import DCOracle2 + avail_types.append(type(DCOracle2.Date(0,0,0))) + except ImportError: + pass + return avail_types + + def availableTypes(): #return ('string'(py2.1)/'str'(py2.2), 'int', 'float', 'tuple') ! avail_types=[ types.StringType, ! types.IntType, ! types.FloatType, ! #types.TupleType, ! ] ! avail_types.extend(date_types()) ! return tuple([t.__name__ for t in avail_types]) try: *************** *** 497,505 **** if type(value)==types.LongType: if self.type()!=types.IntType.__name__: ! #print 'int!=',self.type() _error.addErrorForKey(Validation.TYPE_MISMATCH, self.name()) elif type(value).__name__!=self.type(): _error.addErrorForKey(Validation.TYPE_MISMATCH, self.name()) - #print self.name(),': type(value).__name__: ',type(value).__name__, '!= self.type():',self.type() # String should not exceed width --- 512,523 ---- if type(value)==types.LongType: if self.type()!=types.IntType.__name__: ! _error.addErrorForKey(Validation.TYPE_MISMATCH, self.name()) ! ! elif type(value) in date_types(): ! if self.type() not in [t.__name__ for t in date_types()]: _error.addErrorForKey(Validation.TYPE_MISMATCH, self.name()) + elif type(value).__name__!=self.type(): _error.addErrorForKey(Validation.TYPE_MISMATCH, self.name()) # String should not exceed width |