Changeset 359

Show
Ignore:
Timestamp:
07/01/06 07:13:47
Author:
chervol
Message:

updated the adapter to save data in correct PersistentMapping? structure

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • geolocation/trunk/adapter.py

    r358 r359  
    33from zope.app.annotation.interfaces import IAnnotations, IAnnotatable 
    44from Products.CMFPlone.CatalogTool import registerIndexableAttribute 
     5 
     6GEOLOCATION_KEY = "geolocation.adapter" 
    57 
    68class GEOLocated(object): 
     
    1113    def __init__(self, context): 
    1214        """ init  """ 
    13         self.context = context 
    1415        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 
    1922     
    2023    def getLongitude(self):  
    2124        """ return longtitude """ 
    22         return self.annotations['longitude'] 
     25        return self.geolocation['longitude'] 
    2326     
    2427    def getLatitude(self): 
    2528        """ return latitude """ 
    26         return self.annotations['latitude'] 
     29        return self.geolocation['latitude'] 
    2730         
    2831    def setLongitude(self, value): 
    2932        """ set longtitude """ 
    30         self.annotations['longitude'] = value 
     33        self.geolocation['longitude'] = value 
    3134   
    3235    def setLatitude(self, value): 
    3336        """ set latitutde """ 
    34         self.annotations['latitude'] = value 
     37        self.geolocation['latitude'] = value 
    3538     
    3639    def setLocation(self, longitude, latitude): 
    3740        """ set location """ 
    38         self.annotations['longitude'] = value 
    39         self.annotations['latitude'] = value 
     41        self.geolocation['longitude'] = value 
     42        self.geolocation['latitude'] = value 
    4043         
    4144default = None 
  • geolocation/trunk/configure.zcml

    r358 r359  
    1 <configureŗ 
     1<configure 
    22    xmlns="http://namespaces.zope.org/zope" 
    33    xmlns:browser="http://namespaces.zope.org/browser" 
  • geolocation/trunk/interface.py

    r358 r359  
    66    """GEO location cordinates 
    77    """ 
    8  
     8    """ 
    99    longitude = Float( 
    1010        title=u"Longitude", 
     
    1616        description=u"", 
    1717        required = False ) 
    18  
     18    """ 
    1919     
    2020    def getLongitude():