Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

added simplified feed.kml url

  • Loading branch information...
commit cb9eef0ec5aee764c5e4c7148ef01fbd8f7d897a 1 parent b1ceb6b
Trey Smith trey0 authored

Showing 2 changed files with 19 additions and 10 deletions. Show diff stats Hide diff stats

  1. +16 10 geocamLens/ViewKml.py
  2. +3 0  geocamLens/urls.py
26 geocamLens/ViewKml.py
@@ -52,7 +52,7 @@ def kmlStartSession(self, request):
52 52 print >> sys.stderr, "ViewKml: started session %s" % sessionId
53 53 return KmlUtil.wrapKmlDjango(self.kmlGetStartSessionKml(request, sessionId))
54 54
55   - def kmlGetAllFeaturesFolder(self, request, searchQuery, newUtime):
  55 + def kmlGetAllFeaturesFolder(self, request, searchQuery, newUtime=None):
56 56 allFeatures = self.search.getAllFeatures()
57 57 features = self.search.searchFeatures(allFeatures, searchQuery)
58 58 if 0:
@@ -67,16 +67,19 @@ def kmlGetAllFeaturesFolder(self, request, searchQuery, newUtime):
67 67 </Folder>
68 68 """ % featuresKml)
69 69
70   - def kmlGetInitialKml(self, request, sessionId):
71   - newUtime = datetime.datetime.now()
72   - session, _created = GoogleEarthSession.objects.get_or_create(sessionId=sessionId,
73   - defaults=dict(utime=newUtime))
74   - session.utime = newUtime
75   - session.save()
  70 + def kmlGetInitialKml(self, request, sessionId=None):
  71 + if sessionId:
  72 + newUtime = datetime.datetime.now()
  73 + session, _created = GoogleEarthSession.objects.get_or_create(sessionId=sessionId,
  74 + defaults=dict(utime=newUtime))
  75 + session.utime = newUtime
  76 + session.save()
  77 + query = session.getSearchQuery()
  78 + else:
  79 + newUtime = None
  80 + query = ''
76 81
77   - allFeaturesFolder = self.kmlGetAllFeaturesFolder(request,
78   - session.getSearchQuery(),
79   - newUtime)
  82 + allFeaturesFolder = self.kmlGetAllFeaturesFolder(request, query, newUtime)
80 83 global CACHED_CSS
81 84 if not CACHED_CSS:
82 85 cssPath = '%sgeocamCore/css/share.css' % settings.MEDIA_ROOT
@@ -131,3 +134,6 @@ def kmlGetSessionResponse(self, request, quotedId, method):
131 134 return KmlUtil.wrapKmlDjango(self.kmlGetUpdateKml(request, sessionId))
132 135 else:
133 136 raise Exception('method must be "initial" or "update"')
  137 +
  138 + def kmlFeed(self, request):
  139 + return KmlUtil.wrapKmlDjango(self.kmlGetInitialKml(request))
3  geocamLens/urls.py
@@ -23,6 +23,9 @@
23 23 {'challenge': 'digest',
24 24 'readOnly': True},
25 25 'geocamLens_kmlGetSessionResponse'),
  26 + (r'^feed\.kml$', views.kmlFeed,
  27 + {'readOnly': True},
  28 + 'geocamLens_kml'),
26 29
27 30 # features
28 31 (r'^features.json', views.featuresJson, {'readOnly': True}),

0 comments on commit cb9eef0

Please sign in to comment.
Something went wrong with that request. Please try again.