Cannot save list in db.ListProperty () in Google App Engine

I get an error when trying to save a list in google datastore:

raise BadValueError('Property %s must be a list' % self.name)
BadValueError: Property contactCountry must be a list

contactCountry was created as a list:

contactCountry = list()

And later added:

contactCountry.append(xmlDoc.getElementsByTagName('country')[0].childNodes[0].nodeValue)

There is only one element for this specific example, but it is still a list ... however, I get this error when I try to save it. Any ideas?

Outputs:

logging.info(contactCountry)
logging.info(type(contactCountry))

A:

INFO     2013-12-02 16:38:27,349 downloadAndUpdate.py:72] [u'United States']
INFO     2013-12-02 16:38:27,349 downloadAndUpdate.py:73] <type 'list'>

When I have this error ... I am completely stuck ... thanks!

EDIT:

This is how I define and assign contactCountry:

Database = models.Database() #construct Database object
Information =  Database.get_or_insert(Identifier)
Information.contactCountry = contactCountry

The relevant parts of my models.py file in the same directory have the following structure:

class Database(db.Model):
        contactCountry = db.ListProperty(str)

EDIT2:

- contactCountry db.StringProperty() . contactCountry , models.py db.ListProperty(str), , .

$ dev_appserver.py --clear_datastore [myappname]

. - .

+4
1

- contactCountry db.StringProperty() . contactCountry , models.py db.ListProperty(str), , .

$dev_appserver.py --clear_datastore [myappname]

. - .

0

All Articles