> I do have another question, what would be the self.request method to
> get a date string of "11/11/2008" entered into a html field to be able
> to add it to the data store with a field of DateProperty()?
>
> for example to do the above i'm asking with integer it would be..
> greeting.age = int(self.request.get('age'))
>
> but i'm not sure what it would be for field defined as DateProperty()

DateProperty expects a datetime.date value:
http://code.google.com/appengine/docs/datastore/typesandpropertyclasses.html#DateProperty

You can convert your date string in (presumably) US date format to
Python's datetime.date using this code:

mystr = self.request.get('mydate')
greeting.mydate = datetime.date.fromtimestamp(time.mktime(time.strptime
(mystr, '%m/%d/%Y')))

Also, make sure you handle the parsing errors.

--
www.muspy.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to