summaryrefslogtreecommitdiffstats
path: root/nova/utils.py
diff options
context:
space:
mode:
authorJosh Kearney <josh@jk0.org>2011-03-24 10:32:09 -0500
committerJosh Kearney <josh@jk0.org>2011-03-24 10:32:09 -0500
commit5774357b365e1db624cdd2a9abed9828b27e3314 (patch)
tree7d846cc68d2701b2ae00514655a7e9e437de4f96 /nova/utils.py
parentcf70a1a76dfa0456ea6230eaa014fa98e7ddd464 (diff)
parentc53e56576ead57815f3542a7faa797e5d0135e0c (diff)
downloadnova-5774357b365e1db624cdd2a9abed9828b27e3314.tar.gz
nova-5774357b365e1db624cdd2a9abed9828b27e3314.tar.xz
nova-5774357b365e1db624cdd2a9abed9828b27e3314.zip
Merged trunk
Diffstat (limited to 'nova/utils.py')
-rw-r--r--nova/utils.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/nova/utils.py b/nova/utils.py
index 6042a5332..838e11b3c 100644
--- a/nova/utils.py
+++ b/nova/utils.py
@@ -658,3 +658,12 @@ def get_from_path(items, path):
return results
else:
return get_from_path(results, remainder)
+
+
+def check_isinstance(obj, cls):
+ """Checks that obj is of type cls, and lets PyLint infer types"""
+ if isinstance(obj, cls):
+ return obj
+ raise Exception(_("Expected object of type: %s") % (str(cls)))
+ # TODO(justinsb): Can we make this better??
+ return cls() # Ugly PyLint hack