summaryrefslogtreecommitdiff
path: root/opendc/util
diff options
context:
space:
mode:
Diffstat (limited to 'opendc/util')
-rw-r--r--opendc/util/parameter_checker.py3
-rw-r--r--opendc/util/rest.py10
2 files changed, 4 insertions, 9 deletions
diff --git a/opendc/util/parameter_checker.py b/opendc/util/parameter_checker.py
index 561ed497..d3e7ef13 100644
--- a/opendc/util/parameter_checker.py
+++ b/opendc/util/parameter_checker.py
@@ -66,8 +66,7 @@ def _format_parameter(parameter):
def check(request, **kwargs):
"""Return True if all required parameters are there."""
- for location, params_required in kwargs.iteritems():
-
+ for location, params_required in kwargs.items():
params_actual = getattr(request, 'params_{}'.format(location))
missing_parameter = _missing_parameter(params_required, params_actual)
diff --git a/opendc/util/rest.py b/opendc/util/rest.py
index d5df5306..d892a358 100644
--- a/opendc/util/rest.py
+++ b/opendc/util/rest.py
@@ -40,16 +40,12 @@ class Request(object):
# Parse the path and import the appropriate module
try:
- self.path = message['path'].encode('ascii', 'ignore').strip('/')
+ self.path = message['path'].strip('/')
module_base = 'opendc.api.{}.endpoint'
- module_path = self.path.translate(None, '{}').replace('/', '.')
+ module_path = self.path.replace('/', '.')
self.module = importlib.import_module(module_base.format(module_path))
-
- except UnicodeError:
- raise exceptions.UnimplementedEndpointError('Non-ASCII path')
-
except ImportError:
raise exceptions.UnimplementedEndpointError('Unimplemented endpoint: {}.'.format(self.path))
@@ -68,7 +64,7 @@ class Request(object):
self.google_id = self._verify_token(self.token)
except crypt.AppIdentityError as e:
- raise exceptions.AuthorizationTokenError(e.message)
+ raise exceptions.AuthorizationTokenError(e)
def _verify_token(self, token):
"""Return the ID of the signed-in user.