required=False generates a new error, stating that the only value for required is True.
Luca On Wednesday, July 10, 2013 12:09:56 AM UTC-7, timh wrote: > > Alternately make the property not required (required=False), load the > entities set the value of the list to a [] and then rewrite, once you have > migrated all the entities you can then > set the property to be required. > > You do need to think about model migration when changing classes > adding/removing or changing the types of properties. > > T > > On Wednesday, July 10, 2013 3:07:25 PM UTC+8, timh wrote: >> >> Have you tried setting the default value to [] as per that error ? >> >> If your model is blowing up you can always fetch the underlying data >> without a model, fix the data up and write it back. >> >> T >> >> On Wednesday, July 10, 2013 9:56:50 AM UTC+8, Luca de Alfaro wrote: >>> >>> This is pretty bad! >>> >>> As pointed out in >>> https://code.google.com/p/googleappengine/issues/detail?id=8962 , if >>> you add a StringListProperty to a model with existing entities in the >>> datastore, then you cannot read those entities any more! >>> Furthermore, in Java it is apparently possible to write entities with >>> null StringListProperty fields. Those entities cannot then be read from >>> Python! >>> These are pretty big problems -- is there any solution? >>> >>> Luca >>> >>> On Tuesday, March 23, 2010 5:57:17 AM UTC-7, Geoffrey Spear wrote: >>>> >>>> On Mar 22, 11:09 pm, dhruvbird <[email protected]> wrote: >>>> > Hello, >>>> > I have a model with a single attribute that is a StringListProperty. >>>> > I get an error if I define it as such: >>>> > >>>> > class Test(db.Expando): >>>> > people = db.StringListProperty(required=False, indexed=True) >>>> > >>>> > However, on changing it to: >>>> > class Test(db.Expando): >>>> > people = db.StringListProperty(required=True, indexed=True, >>>> > default=[]) >>>> > >>>> > It starts working. Any ideas why this is happening?? >>>> >>>> ListPropertys are always required; you can't set their value to None. >>>> If a particular entity has no values for the ListProperty, you need to >>>> set it to the empty list. (Note that you can still set a default >>>> value of 'None', which magically uses an empty list, not None, as the >>>> default value.) >>>> >>>> -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/google-appengine. For more options, visit https://groups.google.com/groups/opt_out.
