The field is defined in a db.Model (from from google.appengine.ext) as
follows:
class MyTable(db.Model):
dateTimeCreated = db.DateTimeProperty(auto_now=False)
Code: Select all
if XMLFIELDTYPE == "gd:when":
XMLRESULTS = (XMLRESULTS + " SetDate");
position = XMLVALUES.find(".")
if position > 0:
XMLVALUES = XMLVALUES[0:position] #remove the
microseconds
newdate = time.strptime(XMLVALUES, "%Y-%m-%d %H:%M:%S");
setattr(OBJ,XMLFIELD,newdate); # <---- This is the line
giving the error
XMLRESULTS = (XMLRESULTS + " End:SetDate");
I'm getting this error in the "setattr" statement:
BadValueError: Property dateTimeCreated must be a datetime
Based some previous ideas I was given, I want to dynamically build an
object from my db.model, I set OBJ as follows in the SAX startElement
method. (All the fields that are all-CAPS are global variables.)
Then I need to set all properites by parsing an XML file. So this is
how I instantiated the OBJ variable:
if attribute == "kind":
kind = attributes.getValue(attribute);
XMLRESULTS = XMLRESULTS + "TableName (Kind)=" + kind +
"<br/>";
OBJ = dic[kind]();
Thanks in advance,
Neal Walters
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---