Commit b5916e57 by Kálmán Viktor

occi: handle wrong templates

rOCCI actually checks for these
parent 0f34885e
...@@ -160,6 +160,7 @@ class Compute(Resource): ...@@ -160,6 +160,7 @@ class Compute(Resource):
@classmethod @classmethod
def create_object(cls, data, user): def create_object(cls, data, user):
templates = InstanceTemplate.get_objects_with_level("user", user)
template = None template = None
attributes = {} attributes = {}
links = [] links = []
...@@ -168,7 +169,11 @@ class Compute(Resource): ...@@ -168,7 +169,11 @@ class Compute(Resource):
tmpl = occi_os_tpl_regex.match(d) tmpl = occi_os_tpl_regex.match(d)
if tmpl: if tmpl:
pk = tmpl.group("template_pk") pk = tmpl.group("template_pk")
template = InstanceTemplate.objects.get(pk=pk) try:
template = templates.get(pk=pk)
except InstanceTemplate.DoesNotExist:
raise humanize_exception(ugettext_noop("Unknown template"),
Exception())
attr = occi_attribute_regex.match(d) attr = occi_attribute_regex.match(d)
if attr: if attr:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment