Commit 62153a86 authored by Stauros Kroustouris's avatar Stauros Kroustouris

handle exception in case user is not associated with rule

parent 24e40f42
...@@ -194,13 +194,20 @@ def build_routes_json(groutes): ...@@ -194,13 +194,20 @@ def build_routes_json(groutes):
rd['match'] = r.get_match() rd['match'] = r.get_match()
rd['then'] = r.get_then() rd['then'] = r.get_then()
rd['status'] = r.status rd['status'] = r.status
rd['applier'] = r.applier.username # in case there is no applier (this should not occur)
try: try:
rd['peer'] = r.applier.get_profile().peer.peer_name rd['applier'] = r.applier.username
except UserProfile.DoesNotExist: except:
rd['applier'] = 'unknown'
rd['peer'] = '' rd['peer'] = ''
rd['expires'] = "%s" %r.expires else:
rd['response'] = "%s" %r.response try:
rd['peer'] = r.applier.get_profile().peer.peer_name
except UserProfile.DoesNotExist:
rd['peer'] = ''
rd['expires'] = "%s" % r.expires
rd['response'] = "%s" % r.response
routes.append(rd) routes.append(rd)
return routes return routes
......
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 to comment