# HG changeset patch # User Jeff Hammel # Date 1350494973 25200 # Node ID 234c2427e52b0d88741e93deb9874060b82808c6 # Parent 5babc2ae6c27e0b8e93df0e23cb2608c8b43c29a beginnings of a scan function diff -r 5babc2ae6c27 -r 234c2427e52b dogdish/dispatcher.py --- a/dogdish/dispatcher.py Wed Oct 17 10:18:28 2012 -0700 +++ b/dogdish/dispatcher.py Wed Oct 17 10:29:33 2012 -0700 @@ -5,6 +5,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=800118 """ +import fnmatch import os import sys from urlparse import urlparse @@ -68,7 +69,7 @@ query = {} dogfood_id = self.request.GET.get('dogfood_id') if dogfood_id: - query['dogfood_id'] = dogfood_id + query['dogfooding_prerelease_id'] = dogfood_id # build query string if query: @@ -76,8 +77,11 @@ else: query = '' + # template variables + variables = dict(query=query) + return Response(content_type='text/xml', - body=body % query) + body=body % variables) class Dispatcher(object): """web application""" @@ -113,8 +117,13 @@ def scan(self): """scan the directory for updates""" - contents = os.listdir(self.directory) - + contents = [i for i in os.listdir(self.directory) + if i.startswith('b2g_update_') and i.endswith('.mar')] + contents = set(contents) + new = contents.difference(self.updates.keys()) + if not new: + # directory contents unchanged from cached values + return def main(args=sys.argv[1:]): """CLI entry point"""