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 [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.

Reply via email to