diff dogdish/dispatcher.py @ 7:65d0a1153864

a stub that sorta does something
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 16 Oct 2012 15:42:14 -0700
parents 0a7bf7e70888
children ebb65758d725
line wrap: on
line diff
--- a/dogdish/dispatcher.py	Wed Oct 10 16:31:28 2012 -0700
+++ b/dogdish/dispatcher.py	Tue Oct 16 15:42:14 2012 -0700
@@ -2,6 +2,7 @@
 
 """
 dogdish
+https://bugzilla.mozilla.org/show_bug.cgi?id=800118
 """
 
 import sys
@@ -34,7 +35,7 @@
     body = """<?xml version="1.0"?>
 <updates>
   <update type="minor" appVersion="19.0a1" version="19.0a1" extensionVersion="19.0a1" buildID="20121010114416" licenseURL="http://www.mozilla.com/test/sample-eula.html" detailsURL="http://www.mozilla.com/test/sample-details.html">
-    <patch type="complete" URL="http://update.boot2gecko.org/nightly/b2g_update_2012-10-10_114416.mar" hashFunction="SHA512" hashValue="84edb1f53891cf983bc0f6066d31492f43e2d063aaceb05e1c51876f4fde81635afeb7ce3203dee6f65dd59be0cae5c73c49093b625c99acd4118000ad72dda8" size="42924805"/>
+    <patch type="complete" URL="http://update.boot2gecko.org/nightly/b2g_update_2012-10-10_114416.mar%s" hashFunction="SHA512" hashValue="84edb1f53891cf983bc0f6066d31492f43e2d063aaceb05e1c51876f4fde81635afeb7ce3203dee6f65dd59be0cae5c73c49093b625c99acd4118000ad72dda8" size="42924805"/>
   </update>
 </updates>"""
 
@@ -43,8 +44,20 @@
         return request.method == 'GET'
 
     def __call__(self):
+        body = self.body
+        query = {}
+        dogfood_id = self.request.GET.get('dogfood_id')
+        if dogfood_id:
+            query['dogfood_id'] = dogfood_id
+
+        # build query string
+        if query:
+            query = '?' + '&'.join(['%s=%s' % (key, value) for key, value in query.items()])
+        else:
+            query = ''
+
         return Response(content_type='text/xml',
-                        body=self.body)
+                        body=body % query)
 
 class Dispatcher(object):
 
@@ -83,6 +96,7 @@
 
     app = Dispatcher()
 
+    print "http://localhost:%s/" % options.port
     server = simple_server.make_server(host='0.0.0.0', port=options.port, app=app)
     server.serve_forever()