diff options
author | W. Trevor King <wking@tremily.us> | 2012-08-27 13:37:58 -0400 |
---|---|---|
committer | W. Trevor King <wking@tremily.us> | 2012-08-27 13:37:58 -0400 |
commit | 0fa17f6bf6a809df14ae1930542059a9e62066b0 (patch) | |
tree | 164f7d437785d1ed7350ce64d9b5b12c54c433dc /libbe/storage | |
parent | c09b4d12195c9f2b69ace7369147881103bfe6f4 (diff) | |
download | bugseverywhere-0fa17f6bf6a809df14ae1930542059a9e62066b0.tar.gz |
libbe:util:wsgi: extract WSGI utilities into a separate module.
Diffstat (limited to 'libbe/storage')
-rw-r--r-- | libbe/storage/http.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libbe/storage/http.py b/libbe/storage/http.py index 594fd0d..511e63f 100644 --- a/libbe/storage/http.py +++ b/libbe/storage/http.py @@ -45,6 +45,7 @@ if TESTING == True: import libbe.bugdir import libbe.command.serve + import libbe.util.http class HTTP (base.VersionedStorage): @@ -91,7 +92,8 @@ class HTTP (base.VersionedStorage): headers.append(('Authorization','Basic %s' % \ ('%s:%s' % (self.uname, self.password)).encode('base64'))) return libbe.util.http.get_post_url( - url, get, data_dict, headers, agent=self.user_agent) + url, get, data_dict=data_dict, headers=headers, + agent=self.user_agent) def storage_version(self, revision=None): """Return the storage format for this backend.""" @@ -303,7 +305,11 @@ if TESTING == True: env['QUERY_STRING'] = enc_data for key,value in environ.items(): env[key] = value - return ''.join(app(env, self.start_response)) + try: + result = app(env, self.start_response) + except libbe.util.wsgi.HandlerError as e: + raise libbe.util.http.HTTPError(error=e, url=path, msg=str(e)) + return ''.join(result) def start_response(self, status, response_headers, exc_info=None): self.status = status self.response_headers = response_headers |