Skip to content

Commit

Permalink
Merge branch 'apicreatecall-patch'
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Glatthard committed Aug 11, 2015
2 parents 5bdd9de + 318d293 commit e73f101
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
2 changes: 0 additions & 2 deletions ipynbsrv/web/views/collaborationgroups.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ def create(request):
client = get_httpclient_instance(request)

try:
# stupid create workaround (see containers)
client.collaborationgroups.get()
client.collaborationgroups.post(params)
messages.success(request, "Group `{}` created sucessfully.".format(params.get("name")))
except HttpClientError:
Expand Down
12 changes: 7 additions & 5 deletions ipynbsrv/web/views/containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ def clone(request):
new_name = "{}_clone".format(container.name)

# create clone
client.containers(ct_id).clone.post({"name": new_name})
try:
client.containers(ct_id).clone.post({"name": new_name})
messages.success(request, "Sucessfully created the clone `{}`.".format(new_name))
except Exception as e:
messages.error(request, api_error_message(e, params))

return redirect('containers')

Expand Down Expand Up @@ -96,13 +100,11 @@ def create(request):
image = client.containers.images(params.get('image_id')).get()
except HttpNotFoundError:
messages.error(request, "Container bootstrap image does not exist or you don't have enough permissions for the requested operation.")
except Exception as ex:
messages.error(request, api_error_message(ex, params))

if image:
try:
# does not make any sense, but seems like it won't work without this line
# Todo: find the actual problem!
client.containers.get()

# server and owner get set by the core automatically
client.containers.post(params)
messages.success(request, "Image created successfully.")
Expand Down
3 changes: 0 additions & 3 deletions ipynbsrv/web/views/shares.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ def create(request):
# create a new tag
try:
tag_params = {"label": str(tag)}
t = client.tags.get()
t = client.tags.post(tag_params)
except Exception as e:
messages.error(request, api_error_message(e, tag_params))
Expand Down Expand Up @@ -105,8 +104,6 @@ def share_add_access_groups(request):
params = {}
params['access_groups'] = access_groups

# then call API to add the users to the group
client.shares.get()
try:
client.shares(share_id).add_access_groups.post(params)
messages.success(request, "The selected groups are now a member of this share.")
Expand Down

0 comments on commit e73f101

Please sign in to comment.