Changeset 359
- Timestamp:
- 07/01/06 07:13:47
- Files:
-
- geolocation/trunk/adapter.py (modified) (2 diffs)
- geolocation/trunk/configure.zcml (modified) (1 diff)
- geolocation/trunk/interface.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
geolocation/trunk/adapter.py
r358 r359 3 3 from zope.app.annotation.interfaces import IAnnotations, IAnnotatable 4 4 from Products.CMFPlone.CatalogTool import registerIndexableAttribute 5 6 GEOLOCATION_KEY = "geolocation.adapter" 5 7 6 8 class GEOLocated(object): … … 11 13 def __init__(self, context): 12 14 """ init """ 13 self.context = context14 15 self.annotations = IAnnotations(context) 15 if not self.annotations.get('latitude', None): 16 self.annotations['latitude'] = None 17 if not self.annotations.get('longitude', None): 18 self.annotations['longitude']= None 16 self.geolocation = self.annotations.get(GEOLOCATION_KEY, None) 17 if self.geolocation == None: 18 self.annotations[GEOLOCATION_KEY] = PersistentMapping() 19 self.geolocation = self.annotations[GEOLOCATION_KEY] 20 self.geolocation['latitude'] = None 21 self.geolocation['longitude']= None 19 22 20 23 def getLongitude(self): 21 24 """ return longtitude """ 22 return self. annotations['longitude']25 return self.geolocation['longitude'] 23 26 24 27 def getLatitude(self): 25 28 """ return latitude """ 26 return self. annotations['latitude']29 return self.geolocation['latitude'] 27 30 28 31 def setLongitude(self, value): 29 32 """ set longtitude """ 30 self. annotations['longitude'] = value33 self.geolocation['longitude'] = value 31 34 32 35 def setLatitude(self, value): 33 36 """ set latitutde """ 34 self. annotations['latitude'] = value37 self.geolocation['latitude'] = value 35 38 36 39 def setLocation(self, longitude, latitude): 37 40 """ set location """ 38 self. annotations['longitude'] = value39 self. annotations['latitude'] = value41 self.geolocation['longitude'] = value 42 self.geolocation['latitude'] = value 40 43 41 44 default = None geolocation/trunk/configure.zcml
r358 r359 1 <configure ŗ1 <configure 2 2 xmlns="http://namespaces.zope.org/zope" 3 3 xmlns:browser="http://namespaces.zope.org/browser" geolocation/trunk/interface.py
r358 r359 6 6 """GEO location cordinates 7 7 """ 8 8 """ 9 9 longitude = Float( 10 10 title=u"Longitude", … … 16 16 description=u"", 17 17 required = False ) 18 18 """ 19 19 20 20 def getLongitude():
