diff dogdish/dispatcher.py @ 18:6ffbad8cc31f

deal with paths
author jhammel
date Fri, 26 Oct 2012 15:11:06 +0000
parents 427a94428f04
children 608df6b3de80
line wrap: on
line diff
--- a/dogdish/dispatcher.py	Fri Oct 26 15:04:47 2012 +0000
+++ b/dogdish/dispatcher.py	Fri Oct 26 15:11:06 2012 +0000
@@ -112,7 +112,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/%(update)s%(query)s" hashFunction="SHA512" hashValue="%(hash)s" size="%(size)s"/>
+    <patch type="complete" URL="http://update.boot2gecko.org/%(path)s/%(update)s%(query)s" hashFunction="SHA512" hashValue="%(hash)s" size="%(size)s"/>
   </update>
 </updates>"""
 
@@ -145,6 +145,7 @@
         variables = dict(update=current_update.filename,
                          size=current_update.size,
                          hash=current_update.hash(),
+                         path=self.app.path,
                          query=query)
 
         return Response(content_type='text/xml',
@@ -155,7 +156,8 @@
 
 
     ### class level variables
-    defaults = {'directory': here, 
+    defaults = {'directory': here,
+                'path': None,
                 'update_class': Update}
 
     def __init__(self, **kw):
@@ -165,6 +167,10 @@
             setattr(self, key, kw.get(key, self.defaults[key]))
         self.handlers = [ Get ]
 
+        # path
+        if not self.path:
+            self.path = os.path.split(self.directory.strip(os.path.sep))
+
         # cache
         self.updates = {}
         self.current_update = None