def text_date_synonym(name):
 def getter(self):
  return getattr(self, name)
 def setter(self, value):
  if isinstance(value, basestring):
   try:
    setattr(self, name, datetime.strptime(value, u'%Y-%m-%d'))
   except ValueError:
    setattr(self, name, None)
  else:
   setattr(self, name, value)
 return synonym(name, descriptor=property(getter, setter))

def text_date_synonym ( name ) : def getter ( self ) : return getattr ( self , name ) def setter ( self , value ) : if isinstance ( value , basestring ) : try : setattr ( self , name , datetime . strptime ( value , u'%Y-%m-%d' ) ) except ValueError : setattr ( self , name , None ) else : setattr ( self , name , value ) return synonym ( name , descriptor = property ( getter , setter ) )
converts y-m-d date strings into datetime objects .