comparison dogdish/dispatcher.py @ 19:608df6b3de80

interpolate all the things
author jhammel
date Fri, 26 Oct 2012 15:27:41 +0000
parents 6ffbad8cc31f
children 71c36a7842d1
comparison
equal deleted inserted replaced
18:6ffbad8cc31f 19:608df6b3de80
109 """handle GET requests""" 109 """handle GET requests"""
110 110
111 # template for response body 111 # template for response body
112 body = """<?xml version="1.0"?> 112 body = """<?xml version="1.0"?>
113 <updates> 113 <updates>
114 <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"> 114 <update type="minor" appVersion="%(version)s" version="%(version)s" extensionVersion="%(version)s" buildID="%(build_id)s" licenseURL="http://www.mozilla.com/test/sample-eula.html" detailsURL="http://www.mozilla.com/test/sample-details.html">
115 <patch type="complete" URL="http://update.boot2gecko.org/%(path)s/%(update)s%(query)s" hashFunction="SHA512" hashValue="%(hash)s" size="%(size)s"/> 115 <patch type="complete" URL="http://update.boot2gecko.org/%(path)s/%(update)s%(query)s" hashFunction="SHA512" hashValue="%(hash)s" size="%(size)s"/>
116 </update> 116 </update>
117 </updates>""" 117 </updates>"""
118 118
119 ### methods for request handler 119 ### methods for request handler
142 142
143 143
144 # template variables 144 # template variables
145 variables = dict(update=current_update.filename, 145 variables = dict(update=current_update.filename,
146 size=current_update.size, 146 size=current_update.size,
147 version=application.version,
147 hash=current_update.hash(), 148 hash=current_update.hash(),
148 path=self.app.path, 149 path=self.app.path,
150 build_id=application.build_id,
149 query=query) 151 query=query)
150 152
151 return Response(content_type='text/xml', 153 return Response(content_type='text/xml',
152 body=body % variables) 154 body=body % variables)
153 155
167 setattr(self, key, kw.get(key, self.defaults[key])) 169 setattr(self, key, kw.get(key, self.defaults[key]))
168 self.handlers = [ Get ] 170 self.handlers = [ Get ]
169 171
170 # path 172 # path
171 if not self.path: 173 if not self.path:
172 self.path = os.path.split(self.directory.strip(os.path.sep)) 174 self.path = os.path.split(self.directory.strip(os.path.sep))[-1]
173 175
174 # cache 176 # cache
175 self.updates = {} 177 self.updates = {}
176 self.current_update = None 178 self.current_update = None
177 179