Permalink
Browse files

initial commit

  • Loading branch information...
0 parents commit 491056c7f4fd9649134b5ca04a75ad99fcb68990 @progrium committed Aug 30, 2011
Showing with 599 additions and 0 deletions.
  1. +8 −0 app.yaml
  2. +11 −0 index.yaml
  3. +59 −0 main.py
  4. +509 −0 pytracker.py
  5. +12 −0 widget.html
@@ -0,0 +1,8 @@
+application: tracker-widget
+version: 1
+runtime: python
+api_version: 1
+
+handlers:
+- url: .*
+ script: main.py
@@ -0,0 +1,11 @@
+indexes:
+
+# AUTOGENERATED
+
+# This index.yaml is automatically updated whenever the dev_appserver
+# detects that a new type of query is run. If you want to manage the
+# index.yaml file manually, remove the above marker line (the line
+# saying "# AUTOGENERATED"). If you want to manage some indexes
+# manually, move them above the marker line. The index.yaml file is
+# automatically uploaded to the admin console when you next deploy
+# your application using appcfg.py.
59 main.py
@@ -0,0 +1,59 @@
+from google.appengine.ext import webapp
+from google.appengine.ext.webapp import util
+from google.appengine.ext.webapp import template
+
+from pytracker import Tracker
+from pytracker import Story
+from pytracker import HostedTrackerAuth
+
+def stories_for_view(stories):
+ return [dict(
+ name=s.name,
+ owner=''.join([n[0] for n in s.owned_by.split(' ')]),
+ labels=(', '.join(list(s.labels))) if s.labels else '')
+ for s in stories]
+
+class MainHandler(webapp.RequestHandler):
+ def get(self):
+ self.response.out.write('Hello world!')
+
+class StoryWidgetHandler(webapp.RequestHandler):
+ def get(self):
+ css = self.request.get('css')
+ username = self.request.get('username')
+ password = self.request.get('password')
+ project_id = self.request.get('project_id')
+ filter = self.request.get('filter')
+
+ auth = HostedTrackerAuth(username, password)
+ project = Tracker(int(project_id), auth)
+ stories = stories_for_view(project.GetStories(filter))
+
+ self.response.out.write(template.render('widget.html',
+ {'stories': stories, 'css': css}))
+
+class IterationWidgetHandler(webapp.RequestHandler):
+ def get(self):
+ css = self.request.get('css')
+ username = self.request.get('username')
+ password = self.request.get('password')
+ project_id = self.request.get('project_id')
+ iteration = self.request.get('iteration')
+
+ auth = HostedTrackerAuth(username, password)
+ project = Tracker(int(project_id), auth)
+ stories = stories_for_view(project.GetIterationStories(iteration))
+
+ self.response.out.write(template.render('widget.html',
+ {'stories': stories, 'css': css}))
+
+def main():
+ application = webapp.WSGIApplication([
+ ('/', MainHandler),
+ ('/widget/stories', StoryWidgetHandler),
+ ('/widget/iteration', IterationWidgetHandler), ], debug=True)
+ util.run_wsgi_app(application)
+
+
+if __name__ == '__main__':
+ main()
Oops, something went wrong.

0 comments on commit 491056c

Please sign in to comment.