source: products/geolocation/trunk/browser/location.py @ 3218

Last change on this file since 3218 was 1, checked in by myroslav, 18 years ago

Building directory structure

  • Property svn:eol-style set to native
File size: 1.0 KB
Line 
1# zope 3 imports
2from zope.interface import implements
3
4# Five imports
5from Products.Five.browser import BrowserView
6
7# Product imports
8from Products.geolocation.interfaces.geolocation import IGEOLocated, IGEOLocatedView
9
10class GEOLocatedView(BrowserView):
11
12    implements(IGEOLocatedView)
13
14    def __init__(self, context, request):
15        """ init view """
16        self.context = context
17        self.request = request
18        self.location = IGEOLocated(self.context, None)
19        self.latitude = self.location and self.location.getLatitude() or None
20        self.longitude = self.location and self.location.getLongitude() or None
21
22    def editLocation(self, latitude=None, longitude=None):
23        """ update location properties """
24        self.location.setLocation(latitude, longitude)
25        self.context.reindexObject()
26
27    def getLatitude(self):
28       """ return location latitude """
29       return self.latitude
30
31    def getLongitude(self):
32       """ return location longitude """
33       return self.longitude
Note: See TracBrowser for help on using the repository browser.