This stumped me for a while recently. I discovered that it was
reported as a bug back in August: 
http://code.google.com/p/googleappengine/issues/detail?id=3646

On the bug page I included a workaround I found, which is just to
bypass the empty validation check for list types. For redundancy, here
it is again.

As of version 1.4.1, line 1313 of
google.appengine.api.datastore_types.py reads:

  if not values:

Change that to:

  if not values_type is list and not values:

And you should be good to go. Hope that helps.


On Dec 30 2010, 2:32 pm, Justin <justin.worr...@gmail.com> wrote:
> I have a csv sheet I need to bulkload into AppEngine.
>
> One of the fields is a list of integers of the form (eg) "1,2,3"; the
> list can be empty.
>
> I'm using the following import_transform function (where fn=int):
>
> def parse_array(fn):
>     def wrapper(value):
>         return [fn(seg) for seg in re.split("\\,", value) if not
> seg=='']
>     return wrapper
>
> This barfs on bulkloading -
>
> >> BadValueError: May not use the empty list as a property value; property 
> >> myarray is [].
>
> OK, try again -
>
> def parse_array(fn):
>     def wrapper(value):
>         if value == '' or value is None or value == []:
>             return None
>         return [fn(seg) for seg in re.split("\\,", value)]
>     return wrapper
>
> This bulkloads fine; but if I try to load an entity with an empty list
> field I get the following -
>
> >> BadValueError: Property myarray must be a list
>
> Can anyone suggest how empty db.ListProperty fields should be
> initialised from bulkloader ?
>
> Thanks.

-- 
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 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to