# HG changeset patch # User Atul Varma # Date 1261694308 28800 # Node ID 97e6812435798dcda99518cf17aff6f45b1e523c # Parent 9748d997cbf7abd1630fb208f4518ac41c4e6acb updated readme and made example.py run only when it is the main script diff -r 9748d997cbf7 -r 97e681243579 README.txt --- a/README.txt Thu Dec 24 14:33:51 2009 -0800 +++ b/README.txt Thu Dec 24 14:38:28 2009 -0800 @@ -4,6 +4,6 @@ Then run: - nosetests . + nosetests --with-doctest Otherwise, you're on your own. diff -r 9748d997cbf7 -r 97e681243579 example.py --- a/example.py Thu Dec 24 14:33:51 2009 -0800 +++ b/example.py Thu Dec 24 14:38:28 2009 -0800 @@ -5,35 +5,39 @@ import pymongo import bzapi -logging.basicConfig(level=logging.DEBUG) +def run(): + logging.basicConfig(level=logging.DEBUG) -connection = pymongo.Connection('localhost', 27017) -db = connection.bzapi_example_db + connection = pymongo.Connection('localhost', 27017) + db = connection.bzapi_example_db -api = bzapi.BugzillaApi( - base_url = 'https://api-dev.bugzilla.mozilla.org/latest', - collection = db.api - ) + api = bzapi.BugzillaApi( + base_url = 'https://api-dev.bugzilla.mozilla.org/latest', + collection = db.api + ) -#db.bugs.remove({}) + #db.bugs.remove({}) -search = bzapi.CachedSearch( - api = api, - collection = db.bugs, - changed_after='2009-12-20T12:00:00Z', - product='Mozilla Labs', - component='Jetpack' - ) + search = bzapi.CachedSearch( + api = api, + collection = db.bugs, + changed_after='2009-12-20T12:00:00Z', + product='Mozilla Labs', + component='Jetpack' + ) + + search.update() + #print search.bugs.find_one({'id': '536619'}) -search.update() -#print search.bugs.find_one({'id': '536619'}) + #print len([bug for bug in search.bugs.itervalues()]) -#print len([bug for bug in search.bugs.itervalues()]) + #print search.bugs.values()[12] + + #print api.get('/bug/510339/history') -#print search.bugs.values()[12] - -#print api.get('/bug/510339/history') + #print api.get('/bug', + # product='Mozilla Labs', component='Jetpack', + # changed_after=now-timedelta(minutes=60)) -#print api.get('/bug', -# product='Mozilla Labs', component='Jetpack', -# changed_after=now-timedelta(minutes=60)) +if __name__ == '__main__': + run()