Esempio n. 1
0
 def setGeocodeCache(self, REQUEST=None):
     """ Store a JSON representation of
         the Google Maps geocode cache
     """
     cache = extractPostContent(REQUEST)
     try: cache = cache.decode('utf-8')
     except: pass
     self.geocache = cache
     return True
Esempio n. 2
0
 def setGeocodeCache(self, REQUEST=None):
     """ Store a JSON representation of
         the Google Maps geocode cache
     """
     cache = extractPostContent(REQUEST)
     try:
         cache = cache.decode('utf-8')
     except:
         pass
     self.geocache = cache
     return True
Esempio n. 3
0
 def setGeocodeCache(self, REQUEST=None):
     """
     This method takes the geocodecache from the client and
     updates the methods on the locations with the latest latlong
     """
     cache = extractPostContent(REQUEST)
     try: cache = cache.decode('utf-8')
     except: pass
     from json import loads
     geocode = loads(cache)
     for uid, geo in geocode.iteritems():
         try:
             loc = self.unrestrictedTraverse(str(uid))
             if loc.latlong != geo['latlong']:
                 loc.latlong = geo['latlong']
         except (KeyError, NotFound):
             # the location might have been removed or renamed
             # and the client still had the cache.
             continue
Esempio n. 4
0
 def setGeocodeCache(self, REQUEST=None):
     """
     This method takes the geocodecache from the client and
     updates the methods on the locations with the latest latlong
     """
     cache = extractPostContent(REQUEST)
     try: cache = cache.decode('utf-8')
     except: pass
     from json import loads
     geocode = loads(cache)
     for uid, geo in geocode.iteritems():
         try:
             loc = self.unrestrictedTraverse(str(uid))
             if loc.latlong != geo['latlong']:
                 loc.latlong = geo['latlong']
         except (KeyError, NotFound):
             # the location might have been removed or renamed
             # and the client still had the cache.
             continue