summaryrefslogtreecommitdiffstats
path: root/keystone/utils.py
diff options
context:
space:
mode:
authorZiad Sawalha <ziad.sawalha@rackspace.com>2011-07-08 14:06:49 -0700
committerZiad Sawalha <ziad.sawalha@rackspace.com>2011-07-08 14:06:49 -0700
commitebe8e255ac42c07da7bfc44fd19c1f052d3f8853 (patch)
tree6523f26ec7c2a41de525d97ff3ae3f97e12dbde3 /keystone/utils.py
parent9528697d2fcfbe9b7ba1d445280d10dc4c8e1e8d (diff)
parent418a9e5913fe25fb4c5e704655d2497da3bc5d41 (diff)
downloadkeystone-ebe8e255ac42c07da7bfc44fd19c1f052d3f8853.tar.gz
keystone-ebe8e255ac42c07da7bfc44fd19c1f052d3f8853.tar.xz
keystone-ebe8e255ac42c07da7bfc44fd19c1f052d3f8853.zip
Merge pull request #82 from dolph/master
Global fixes for issues #33 and #65
Diffstat (limited to 'keystone/utils.py')
-rwxr-xr-xkeystone/utils.py19
1 files changed, 4 insertions, 15 deletions
diff --git a/keystone/utils.py b/keystone/utils.py
index ddd63760..96991364 100755
--- a/keystone/utils.py
+++ b/keystone/utils.py
@@ -16,19 +16,10 @@
import functools
-import httplib
-import json
import logging
import os
-import routes
import sys
-import hashlib
from webob import Response
-from webob import Request
-from webob import descriptors
-from webob.exc import (HTTPNotFound,
- HTTPConflict,
- HTTPBadRequest)
POSSIBLE_TOPDIR = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
os.pardir,
@@ -36,14 +27,12 @@ POSSIBLE_TOPDIR = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'keystone', '__init__.py')):
sys.path.insert(0, POSSIBLE_TOPDIR)
-from queryext import exthandler
import keystone.logic.types.fault as fault
def is_xml_response(req):
- if not "Accept" in req.headers:
- return False
- return req.content_type == "application/xml"
+ """Returns True when the request wants an XML response, False otherwise"""
+ return "Accept" in req.headers and "application/xml" in req.accept
def get_app_root():
@@ -180,5 +169,5 @@ def import_module(module_name, class_name=None):
__import__(module_name)
return getattr(sys.modules[module_name], class_name)
except (ImportError, ValueError, AttributeError), exception:
- raise ImportError(_('Class %s.%s cannot be found (%s)') %
- (module_name, class_name, exception)) \ No newline at end of file
+ raise ImportError(_('Class %s.%s cannot be found (%s)') %
+ (module_name, class_name, exception))