Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added simplified feed.kml url

  • Loading branch information...
commit cb9eef0ec5aee764c5e4c7148ef01fbd8f7d897a 1 parent b1ceb6b
Trey Smith trey0 authored
Showing with 19 additions and 10 deletions.
  1. +16 −10 geocamLens/ViewKml.py
  2. +3 −0  geocamLens/urls.py
26 geocamLens/ViewKml.py
View
@@ -52,7 +52,7 @@ def kmlStartSession(self, request):
print >> sys.stderr, "ViewKml: started session %s" % sessionId
return KmlUtil.wrapKmlDjango(self.kmlGetStartSessionKml(request, sessionId))
- def kmlGetAllFeaturesFolder(self, request, searchQuery, newUtime):
+ def kmlGetAllFeaturesFolder(self, request, searchQuery, newUtime=None):
allFeatures = self.search.getAllFeatures()
features = self.search.searchFeatures(allFeatures, searchQuery)
if 0:
@@ -67,16 +67,19 @@ def kmlGetAllFeaturesFolder(self, request, searchQuery, newUtime):
</Folder>
""" % featuresKml)
- def kmlGetInitialKml(self, request, sessionId):
- newUtime = datetime.datetime.now()
- session, _created = GoogleEarthSession.objects.get_or_create(sessionId=sessionId,
- defaults=dict(utime=newUtime))
- session.utime = newUtime
- session.save()
+ def kmlGetInitialKml(self, request, sessionId=None):
+ if sessionId:
+ newUtime = datetime.datetime.now()
+ session, _created = GoogleEarthSession.objects.get_or_create(sessionId=sessionId,
+ defaults=dict(utime=newUtime))
+ session.utime = newUtime
+ session.save()
+ query = session.getSearchQuery()
+ else:
+ newUtime = None
+ query = ''
- allFeaturesFolder = self.kmlGetAllFeaturesFolder(request,
- session.getSearchQuery(),
- newUtime)
+ allFeaturesFolder = self.kmlGetAllFeaturesFolder(request, query, newUtime)
global CACHED_CSS
if not CACHED_CSS:
cssPath = '%sgeocamCore/css/share.css' % settings.MEDIA_ROOT
@@ -131,3 +134,6 @@ def kmlGetSessionResponse(self, request, quotedId, method):
return KmlUtil.wrapKmlDjango(self.kmlGetUpdateKml(request, sessionId))
else:
raise Exception('method must be "initial" or "update"')
+
+ def kmlFeed(self, request):
+ return KmlUtil.wrapKmlDjango(self.kmlGetInitialKml(request))
3  geocamLens/urls.py
View
@@ -23,6 +23,9 @@
{'challenge': 'digest',
'readOnly': True},
'geocamLens_kmlGetSessionResponse'),
+ (r'^feed\.kml$', views.kmlFeed,
+ {'readOnly': True},
+ 'geocamLens_kml'),
# features
(r'^features.json', views.featuresJson, {'readOnly': True}),
Please sign in to comment.
Something went wrong with that request. Please try again.