[google-appengine] Re: Dynamically Choosing Which Properties to Write to the Datastore

2009-01-26 Thread boson
Consider wrapping the get/change/put in a transaction: http://code.google.com/appengine/docs/python/datastore/transactions.html On Jan 25, 9:28 pm, David Kamenetz wrote: > I finally got this working. > > My python module looked something like this: > > from google.appengine.ext.db import Key >

[google-appengine] Re: Dynamically Choosing Which Properties to Write to the Datastore

2009-01-25 Thread kang
now I get your point...good example On Sun, Jan 25, 2009 at 9:28 PM, David Kamenetz wrote: > > I finally got this working. > > My python module looked something like this: > > from google.appengine.ext.db import Key > from google.appengine.api.datastore import Get, Put > > def edit_item(request,

[google-appengine] Re: Dynamically Choosing Which Properties to Write to the Datastore

2009-01-25 Thread David Kamenetz
I finally got this working. My python module looked something like this: from google.appengine.ext.db import Key from google.appengine.api.datastore import Get, Put def edit_item(request, db_id): objKey = Key(str(db_id)) if request.method == 'POST': objEntity = Get(objKey)

[google-appengine] Re: Dynamically Choosing Which Properties to Write to the Datastore

2009-01-24 Thread David Kamenetz
Thanks Bill, that was helpful. I had been browsing datastore.py in the SDK, but I wasn't quite sure how to use it. Your solution gave me a lot of ideas. Regards, David On Jan 24, 7:11 pm, Bill wrote: > Hi David, > > On Jan 24, 8:39 am, David Kamenetz wrote: > > > However, if the user only ente

[google-appengine] Re: Dynamically Choosing Which Properties to Write to the Datastore

2009-01-24 Thread Bill
Hi David, On Jan 24, 8:39 am, David Kamenetz wrote: > However, if the user only enters/changes, say, the txt field on the > form I only POST the txt field to the server. I don't send all the > fields. My POST only has data for txt. If I use the code above on an > existing entity, it will erase t

[google-appengine] Re: Dynamically Choosing Which Properties to Write to the Datastore

2009-01-24 Thread David Kamenetz
Hmm...I'm not sure how to use your suggestion. Maybe if I make my question more specific it will help. My html looks something like this: Title: Text: Image: If I were writing every field, every time, my python (Django) would look something like this: if request.POST: formite

[google-appengine] Re: Dynamically Choosing Which Properties to Write to the Datastore

2009-01-24 Thread kang
You can get the form data through self.request.get("name") and give the object proper property. for example, in the html in the server side, you write, class Submit(webapp.RequestHandler): def post(self): a = self.request.POST.get('a') b = self.request.POST.get('b')