Commit a396b494 authored by Alex Pyrgiotis's avatar Alex Pyrgiotis

admin: Import exceptions from the same file

Use exceptions.py as the file to import admin exceptions from.
parent 89ee0a67
import logging
# Copyright (C) 2010-2014 GRNET S.A.
#
# This program is free software: you can redistribute it and/or modify
......@@ -26,7 +25,7 @@ from astakos.im.models import AstakosUserAuthProvider
from astakos.im.models import AstakosUser
from eztables.views import DatatablesView
from actions import AdminAction, AdminActionUnknown, AdminActionNotPermitted
from actions import AdminAction
templates = {
'list': 'admin/auth_provider_list.html',
......
......@@ -26,8 +26,7 @@ from django.contrib.auth.models import Group
from synnefo_admin.admin.exceptions import AdminHttp404
from eztables.views import DatatablesView
from synnefo_admin.admin.actions import (AdminAction, AdminActionUnknown,
AdminActionNotPermitted)
from synnefo_admin.admin.actions import AdminAction
templates = {
'list': 'admin/group_list.html',
......
......@@ -41,7 +41,7 @@ from synnefo.admin import stats as cyclades_stats
from synnefo_admin.admin.exceptions import AdminHttp404, AdminHttp405
from synnefo_admin import admin_settings
from synnefo_admin.admin import actions
from synnefo_admin.admin import exceptions
from synnefo_admin.admin.utils import (conditionally_gzip_page,
customize_details_context, admin_log)
......@@ -337,7 +337,7 @@ def admin_actions(request):
status = 400
response['result'] = e.message
response['error_ids'].append(id)
except actions.AdminActionNotPermitted:
except exceptions.AdminActionNotPermitted:
status = 403
response['result'] = "You are not allowed to do this operation."
response['error_ids'].append(id)
......@@ -345,15 +345,15 @@ def admin_actions(request):
status = 403
response['result'] = "You are not allowed to do this operation."
response['error_ids'].append(id)
except actions.AdminActionUnknown:
except exceptions.AdminActionUnknown:
status = 404
response['result'] = "You have requested an unknown operation."
break
except actions.AdminActionNotImplemented:
except exceptions.AdminActionNotImplemented:
status = 501
response['result'] = "You have requested an unimplemented action."
break
except actions.AdminActionCannotApply:
except exceptions.AdminActionCannotApply:
status = 400
response['result'] = """
You have requested an action that cannot apply to a target.
......
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