I translated the application from Datastore to ndb and ran into a problem in the xml import procedure. The problem is that I cannot programmatically determine if a property of the ndb.model class is a multi-valued property or not.
I suspect this is due to a lack of basic Python skills, as the code I have cited so far shows that the value is "visible." Therefore, I cannot grab him. Please, help.
from google.appengine.ext import ndb
class House(ndb.Model):
name = ndb.StringProperty()
rooms = ndb.StringProperty(repeated=True)
print 'Properties:'
for p in House._properties:
print getattr(House,p)
print '\nRepeated:'
for p in House._properties:
print getattr(getattr(House,p),'repeated',None)
The result is the following:
Properties:
StringProperty('rooms', repeated=True)
StringProperty('name')
Repeated:
None
None
source
share