Skip to content

Commit

Permalink
Ensure don't try save with Group '-1'
Browse files Browse the repository at this point in the history
  • Loading branch information
Will Moore committed Mar 10, 2014
1 parent 532de38 commit 708b968
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions views.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ def save_web_figure(request, conn=None, **kwargs):
pass

# Try to set Group context to the same as first image
currGid = conn.SERVICE_OPTS.getOmeroGroup()
try:
json_data = json.loads(figureJSON)
panel = json_data['panels'][0]
Expand All @@ -179,9 +180,12 @@ def save_web_figure(request, conn=None, **kwargs):
if i is not None:
gid = i.getDetails().group.id.val
conn.SERVICE_OPTS.setOmeroGroup(gid)
else:
# Don't leave as -1
conn.SERVICE_OPTS.setOmeroGroup(currGid)
except:
# Maybe give user warning that figure json is invalid?
pass
# revert back
conn.SERVICE_OPTS.setOmeroGroup(currGid)
fileSize = len(figureJSON)
f = StringIO()
f.write(figureJSON)
Expand Down

0 comments on commit 708b968

Please sign in to comment.