I have a model class that looks like this:
from google.appengine.ext import db, search
class WorldRegion(search.SearchableModel):
cityName = db.StringProperty()
regionName = db.StringProperty()
countryName = db.StringProperty()
latitude = db.FloatProperty()
longitude = db.FloatProperty()
locationcode = db.StringProperty()
completeName = db.TextProperty()
When the entries are loaded manually, the searches against this entity
returns the right entries. But when the same entries are loaded using
the bulkloader, the results of searches are always empty. What could
cause this problem?
Here what the loader class looks like:
import datetime
from google.appengine.ext import db
from google.appengine.tools import bulkloader
import WorldRegion
def handle_type(func):
def wrapper(val):
if val != '': return func(val)
else: return None
return wrapper
def utfUnicode(s): return unicode(s, 'utf-8')
def utfText(s): return db.Text(s, encoding='utf-8')
class WorldRegionLoader(bulkloader.Loader):
def __init__(self):
bulkloader.Loader.__init__(self, 'WorldRegion',
[('locationcode', utfUnicode),
('countryName', utfUnicode),
('countryCode', utfUnicode),
('regionName', utfUnicode),
('latitude', handle_type(float)),
('longitude', handle_type(float)),
('completeName', utfText),
])
loaders = [WorldRegion]
Thanks,
Mathieu
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---