Changeset 357

Show
Ignore:
Timestamp:
06/30/06 12:08:49
Author:
chervol
Message:

global renames

Files:

Legend:

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

    r356 r357  
    11from zope.interface import implements 
    2 from interface import IGEOLocation 
     2from interface import IGEOLocated 
    33from zope.app.annotation.interfaces import IAnnotations, IAnnotatable 
    44from Products.CMFPlone.CatalogTool import registerIndexableAttribute 
    55 
    6 class GEOLocation(object): 
     6class GEOLocated(object): 
    77    """ geolocation 
    88    """ 
    9     implements(IGEOLocation
     9    implements(IGEOLocated
    1010     
    1111    def __init__(self, context): 
     
    3434        self.annotations['latitude'] = value 
    3535     
    36     #def updateLocation(self, longitude, latitude): 
    37     #    """ """ 
    38      
     36    def setLocation(self, longitude, latitude): 
     37        """ set location """ 
     38        self.annotations['longitude'] = value 
     39        self.annotations['latitude'] = value 
     40         
    3941default = None 
     42 
     43def geoLocation(obj, portal, **kw): 
     44    """ long idx """ 
     45    adapter = IGEOLocated(obj, None) 
     46    if adapter: 
     47        return (adapter.getLongitude(), adapter.getLatitude()) 
     48    return default 
    4049 
    4150def Longitude(obj, portal, **kw): 
    4251    """ long idx """ 
    43     adapter = IGEOLocation(obj, None) 
     52    adapter = IGEOLocated(obj, None) 
    4453    if adapter: 
    4554        return adapter.getLongitude() 
     
    4857def Latitude(obj, portal, **kw): 
    4958    """ lat idx """ 
    50     adapter = IGEOLocation(obj, None) 
     59    adapter = IGEOLocated(obj, None) 
    5160    if adapter: 
    5261        return adapter.getLatitude() 
  • geolocation/trunk/browser/edit_location.pt

    r356 r357  
    1111 
    1212        <div tal:define="location context/@@LocationView"> 
    13  
     13        <tal:x condition="location/location"> 
    1414        <h1 class="documentFirstHeading" 
    1515          i18n:translate="heading_location">Location</h1> 
    16  
    1716        <form action="#" method="post" 
    1817              tal:attributes="action context/absolute_url"> 
     
    2625              </label> 
    2726              <input type="text" name="longitude" 
    28                         tal:attributes="value location/getLongitude" /> 
     27                        tal:attributes="value location/longitude" /> 
    2928            </div> 
    3029            <div class="field"> 
     
    3332              </label> 
    3433              <input type="text" name="latitude" 
    35                      tal:attributes="value location/getLatitude" /> 
     34                     tal:attributes="value location/latitude" /> 
    3635            </div> 
    3736           
     
    4342          </fieldset> 
    4443        </form> 
    45  
    46  
     44        </tal:x> 
     45        <tal:x condition="not:location/location"> 
     46            The object can't be adapted to IGEOLocated 
     47        </tal:x> 
    4748      </div> 
    4849    </div> 
  • geolocation/trunk/browser/location.py

    r356 r357  
    66 
    77# Product imports 
    8 from Products.geolocation.interface import IGEOLocation, ILocationView 
     8from Products.geolocation.interface import IGEOLocated, IGEOLocatedView 
    99from zLOG import LOG 
    1010import sys, traceback 
    1111from StringIO import StringIO 
    1212 
    13 class LocationView(BrowserView): 
     13class GEOLocatedView(BrowserView): 
    1414 
    15     implements(ILocationView) 
    16        
    17 ##    def __init__(self, context, request): 
    18 ##        """ adapt the context """ 
    19 ##        if IGEOLocation.providedBy(self): 
    20 ##            return self 
    21 ##        else: 
    22 ##            location = IGEOLocation(self.context).__of__(self.context) 
    23 ##        return super(LocationView, location).__init__(context, request) 
    24  
     15    implements(IGEOLocatedView) 
     16           
    2517    def __init__(self, context, request): 
     18        """ init view """ 
    2619        self.context = context 
    2720        self.request = request 
    28         self.location = IGEOLocation(self.context
    29         self.longitude = self.location.getLongitude() 
    30         self.latitude = self.location.getLatitude() 
     21        self.location = IGEOLocated(self.context, None
     22        self.longitude = self.location and self.location.getLongitude() or 0 
     23        self.latitude = self.location and self.location.getLatitude() or 0 
    3124  
    32     def getLongitude(self):  
    33         """ return longtitude """ 
    34         return self.longitude 
    35      
    36     def getLatitude(self): 
    37         """ return latitude """ 
    38         return self.latitude 
    39      
    4025    def editLocation(self,longitude=None, latitude=None): 
    4126        """ update location properties """ 
    42         self.location.setLongitude(longitude) 
    43         self.location.setLatitude(latitude) 
     27        self.location.setLocation(longitude, latitude) 
    4428        self.context.reindexObject() 
    4529         
  • geolocation/trunk/configure.zcml

    r356 r357  
    1 <configure 
     1<configureŗ 
    22    xmlns="http://namespaces.zope.org/zope" 
    33    xmlns:browser="http://namespaces.zope.org/browser" 
     
    1212  <adapter 
    1313      for="Products.ATContentTypes.interface.document.IATDocument" 
    14       provides=".interface.IGEOLocation
    15       factory=".adapter.GEOLocation
     14      provides=".interface.IGEOLocated
     15      factory=".adapter.GEOLocated
    1616      />     
    1717 
     
    1919      for="*" 
    2020      name="LocationView" 
    21       class=".browser.location.LocationView" 
     21      class=".browser.location.GEOLocatedView" 
    2222      permission="zope2.View" 
    23       allowed_interface=".interface.ILocationView" 
     23      allowed_interface=".interface.IGEOLocatedView" 
    2424      />   
    2525 
     
    3434      for="*" 
    3535      name="editLocation" 
    36       class=".browser.location.LocationView" 
     36      class=".browser.location.GEOLocatedView" 
    3737      attribute="editLocation" 
    3838      permission="zope2.View" 
  • geolocation/trunk/interface.py

    r356 r357  
    33from zope.schema import Float 
    44 
    5 class IGEOLocation(Interface): 
     5class IGEOLocated(Interface): 
    66    """GEO location cordinates 
    77    """ 
     
    3030        """ set latitutde """ 
    3131 
    32 class ILocationView(Interface): 
     32    def setLocation(longitude, latitude): 
     33       """ set location  """ 
     34 
     35class IGEOLocatedView(Interface): 
    3336    """browser view 
    3437    """ 
    3538 
    36     def editLocation(self, request): 
     39    def editLocation(self, longitude, latitude): 
    3740        """ update location properties """