Last change
on this file was
1,
checked in by myroslav, 19 years ago
|
Building directory structure
|
-
Property svn:eol-style set to
native
|
File size:
1.0 KB
|
Rev | Line | |
---|
[1] | 1 | # zope 3 imports |
---|
| 2 | from zope.interface import implements |
---|
| 3 | |
---|
| 4 | # Five imports |
---|
| 5 | from Products.Five.browser import BrowserView |
---|
| 6 | |
---|
| 7 | # Product imports |
---|
| 8 | from Products.geolocation.interfaces.geolocation import IGEOLocated, IGEOLocatedView |
---|
| 9 | |
---|
| 10 | class 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.