diff options
author | Richard Jones <richard@mechanicalcat.net> | 2013-01-14 16:57:02 +1100 |
---|---|---|
committer | Richard Jones <richard@mechanicalcat.net> | 2013-01-14 16:57:02 +1100 |
commit | cd6cee8bd8e4f13961933eb65e259cbf60572e78 (patch) | |
tree | 52c8a0ca72cfbd8091938f9c4a3fea866f7e6ca1 /rpc.py | |
parent | 4cfe1f8a330889da54b9296cc92b4279719dd28f (diff) | |
download | decorator-cd6cee8bd8e4f13961933eb65e259cbf60572e78.tar.gz |
fixes
Diffstat (limited to 'rpc.py')
-rw-r--r-- | rpc.py | 32 |
1 files changed, 20 insertions, 12 deletions
@@ -1,6 +1,8 @@ import sys import xmlrpclib import traceback +import datetime +import logging import re import time from cStringIO import StringIO @@ -44,6 +46,7 @@ class RequestHandler(SimpleXMLRPCDispatcher): # This should be thread-safe, as the store is really a singleton self.store = webui_obj.store except Exception, e: + logging.exception('reading input') # report as a fault to caller rather than propogating up to generic # exception handler response = xmlrpclib.dumps( @@ -62,7 +65,11 @@ class RequestHandler(SimpleXMLRPCDispatcher): if not method.startswith('system.'): # Add store to all of our own methods params = (self.store,)+tuple(params) - return SimpleXMLRPCDispatcher._dispatch(self, method, params) + try: + return SimpleXMLRPCDispatcher._dispatch(self, method, params) + except Exception, e: + logging.exception('calling %r with %r' % (method, params)) + raise def system_multicall(self, call_list): if len(call_list) > 100: @@ -152,17 +159,18 @@ def updated_releases(store, since): return [(row['name'], row['version']) for row in result] def changelog(store, since, with_ids=False): - result = store.changelog(since) - if with_ids: - return [(row['name'],row['version'], - int(time.mktime(row['submitted_date'].timetuple())), - row['action'], row['id']) - for row in result] - else: - return [(row['name'],row['version'], - int(time.mktime(row['submitted_date'].timetuple())), - row['action']) - for row in result] + result = [] + for row in store.changelog(since): + if isinstance(row['submitted_date'], str): + d = datetime.datetime.strptime(row['submitted_date'], + '%Y-%m-%d %H:%M:%S').timetuple() + else: + d = row['submitted_date'].timetuple() + t = (row['name'],row['version'], d, row['action']) + if with_ids: + t += (row['id'], ) + result.append(t) + return result def changed_packages(store, since): return store.changed_packages(since) |