Commit 7c0ef84e authored by Giorgos Korfiatis's avatar Giorgos Korfiatis Committed by Christos Stavrakakis
Browse files

snf_django: Handle unicode in CommandError

Define a custom CommandError, which applies smart_locale_str() in its
__str__ method. Use this custom CommandError in Astakos management
commands.
parent 794f7588
...@@ -36,7 +36,7 @@ import uuid ...@@ -36,7 +36,7 @@ import uuid
from django.core.validators import validate_email from django.core.validators import validate_email
from django.contrib.auth.models import Permission from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.core.management import CommandError from snf_django.management.commands import CommandError
from synnefo.util import units from synnefo.util import units
from astakos.im.models import AstakosUser from astakos.im.models import AstakosUser
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
# or implied, of GRNET S.A. # or implied, of GRNET S.A.
from synnefo.util import units from synnefo.util import units
from django.core.management import CommandError from snf_django.management.commands import CommandError
from django.db.models import Q from django.db.models import Q
......
...@@ -35,10 +35,9 @@ import string ...@@ -35,10 +35,9 @@ import string
from optparse import make_option from optparse import make_option
from django.core.management.base import CommandError from snf_django.management.commands import SynnefoCommand, CommandError
from astakos.im.models import AuthProviderPolicyProfile as Profile from astakos.im.models import AuthProviderPolicyProfile as Profile
from snf_django.management.commands import SynnefoCommand
option_list = list(SynnefoCommand.option_list) + [ option_list = list(SynnefoCommand.option_list) + [
make_option('--update', make_option('--update',
......
...@@ -31,10 +31,9 @@ ...@@ -31,10 +31,9 @@
# interpreted as representing official policies, either expressed # interpreted as representing official policies, either expressed
# or implied, of GRNET S.A. # or implied, of GRNET S.A.
from django.core.management.base import CommandError from snf_django.management.commands import SynnefoCommand, CommandError
from astakos.im.models import AuthProviderPolicyProfile as Profile from astakos.im.models import AuthProviderPolicyProfile as Profile
from snf_django.management.commands import SynnefoCommand
class Command(SynnefoCommand): class Command(SynnefoCommand):
......
...@@ -34,9 +34,7 @@ ...@@ -34,9 +34,7 @@
from optparse import make_option from optparse import make_option
from django.db import transaction from django.db import transaction
from django.core.management.base import CommandError from snf_django.management.commands import SynnefoCommand, CommandError
from snf_django.management.commands import SynnefoCommand
from astakos.im.models import AuthProviderPolicyProfile as Profile from astakos.im.models import AuthProviderPolicyProfile as Profile
from astakos.im.models import AstakosUser, Group from astakos.im.models import AstakosUser, Group
......
...@@ -31,11 +31,9 @@ ...@@ -31,11 +31,9 @@
# interpreted as representing official policies, either expressed # interpreted as representing official policies, either expressed
# or implied, of GRNET S.A. # or implied, of GRNET S.A.
from django.core.management.base import CommandError
from astakos.im.models import AuthProviderPolicyProfile as Profile from astakos.im.models import AuthProviderPolicyProfile as Profile
from synnefo.lib.ordereddict import OrderedDict from synnefo.lib.ordereddict import OrderedDict
from snf_django.management.commands import SynnefoCommand from snf_django.management.commands import SynnefoCommand, CommandError
from snf_django.management import utils from snf_django.management import utils
......
...@@ -32,10 +32,8 @@ ...@@ -32,10 +32,8 @@
# or implied, of GRNET S.A. # or implied, of GRNET S.A.
from optparse import make_option from optparse import make_option
from django.core.management.base import CommandError from snf_django.management.commands import SynnefoCommand, CommandError
from astakos.im.models import Component from astakos.im.models import Component
from snf_django.management.commands import SynnefoCommand
class Command(SynnefoCommand): class Command(SynnefoCommand):
......
...@@ -32,11 +32,8 @@ ...@@ -32,11 +32,8 @@
# or implied, of GRNET S.A. # or implied, of GRNET S.A.
from optparse import make_option from optparse import make_option
from snf_django.management.commands import SynnefoCommand, CommandError
from django.core.management.base import CommandError
from astakos.im.models import Component from astakos.im.models import Component
from snf_django.management.commands import SynnefoCommand
class Command(SynnefoCommand): class Command(SynnefoCommand):
......
...@@ -31,11 +31,9 @@ ...@@ -31,11 +31,9 @@
# interpreted as representing official policies, either expressed # interpreted as representing official policies, either expressed
# or implied, of GRNET S.A. # or implied, of GRNET S.A.
from django.core.management.base import CommandError from snf_django.management.commands import SynnefoCommand, CommandError
from django.db import transaction from django.db import transaction
from astakos.im.models import Component from astakos.im.models import Component
from snf_django.management.commands import SynnefoCommand
class Command(SynnefoCommand): class Command(SynnefoCommand):
......
...@@ -31,10 +31,9 @@ ...@@ -31,10 +31,9 @@
# interpreted as representing official policies, either expressed # interpreted as representing official policies, either expressed
# or implied, of GRNET S.A. # or implied, of GRNET S.A.
from django.core.management.base import CommandError
from astakos.im.models import Component from astakos.im.models import Component
from synnefo.lib.ordereddict import OrderedDict from synnefo.lib.ordereddict import OrderedDict
from snf_django.management.commands import SynnefoCommand from snf_django.management.commands import SynnefoCommand, CommandError
from snf_django.management import utils from snf_django.management import utils
......
...@@ -32,10 +32,9 @@ ...@@ -32,10 +32,9 @@
# or implied, of GRNET S.A. # or implied, of GRNET S.A.
from django.db import transaction from django.db import transaction
from django.core.management.base import CommandError from snf_django.management.commands import SynnefoCommand, CommandError
from astakos.im.auth import fix_superusers from astakos.im.auth import fix_superusers
from snf_django.management.commands import SynnefoCommand
class Command(SynnefoCommand): class Command(SynnefoCommand):
......
...@@ -31,10 +31,8 @@ ...@@ -31,10 +31,8 @@
# interpreted as representing official policies, either expressed # interpreted as representing official policies, either expressed
# or implied, of GRNET S.A. # or implied, of GRNET S.A.
from django.core.management.base import CommandError from snf_django.management.commands import SynnefoCommand, CommandError
from astakos.im.models import Group from astakos.im.models import Group
from snf_django.management.commands import SynnefoCommand
class Command(SynnefoCommand): class Command(SynnefoCommand):
......
...@@ -34,12 +34,11 @@ ...@@ -34,12 +34,11 @@
from optparse import make_option from optparse import make_option
from django.db import transaction from django.db import transaction
from django.core.management.base import CommandError
from snf_django.management import utils from snf_django.management import utils
from snf_django.management.commands import SynnefoCommand, CommandError
from astakos.im.functions import (terminate, suspend, unsuspend, from astakos.im.functions import (terminate, suspend, unsuspend,
reinstate, check_expiration, reinstate, check_expiration,
approve_application, deny_application) approve_application, deny_application)
from snf_django.management.commands import SynnefoCommand
class Command(SynnefoCommand): class Command(SynnefoCommand):
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
from optparse import make_option from optparse import make_option
from django.db.models import Q from django.db.models import Q
from django.core.management.base import CommandError from snf_django.management.commands import SynnefoCommand, CommandError
from django.db import transaction from django.db import transaction
from synnefo.util import units from synnefo.util import units
from astakos.im import functions from astakos.im import functions
...@@ -43,7 +43,6 @@ import astakos.api.projects as api ...@@ -43,7 +43,6 @@ import astakos.api.projects as api
import synnefo.util.date as date_util import synnefo.util.date as date_util
from snf_django.management import utils from snf_django.management import utils
from astakos.im.management.commands import _common from astakos.im.management.commands import _common
from snf_django.management.commands import SynnefoCommand
def make_policies(limits): def make_policies(limits):
......
...@@ -32,10 +32,9 @@ ...@@ -32,10 +32,9 @@
# or implied, of GRNET S.A. # or implied, of GRNET S.A.
from optparse import make_option from optparse import make_option
from django.core.management.base import CommandError
from synnefo.lib.ordereddict import OrderedDict from synnefo.lib.ordereddict import OrderedDict
from snf_django.management.commands import SynnefoCommand from snf_django.management.commands import SynnefoCommand, CommandError
from snf_django.management import utils from snf_django.management import utils
from astakos.im.models import ProjectApplication, Project from astakos.im.models import ProjectApplication, Project
from astakos.im import quotas from astakos.im import quotas
......
...@@ -34,9 +34,8 @@ ...@@ -34,9 +34,8 @@
from optparse import make_option from optparse import make_option
from datetime import datetime from datetime import datetime
from django.core.management.base import CommandError from snf_django.management.commands import SynnefoCommand, CommandError
from django.db import transaction from django.db import transaction
from snf_django.utils import reconcile from snf_django.utils import reconcile
from snf_django.management.utils import pprint_table from snf_django.management.utils import pprint_table
from astakos.im.models import Component, AstakosUser from astakos.im.models import Component, AstakosUser
...@@ -44,7 +43,6 @@ from astakos.im import quotas ...@@ -44,7 +43,6 @@ from astakos.im import quotas
from astakos.im.functions import count_pending_app from astakos.im.functions import count_pending_app
import astakos.quotaholder_app.callpoint as qh import astakos.quotaholder_app.callpoint as qh
import astakos.quotaholder_app.exception as qh_exception import astakos.quotaholder_app.exception as qh_exception
from snf_django.management.commands import SynnefoCommand
class Command(SynnefoCommand): class Command(SynnefoCommand):
......
...@@ -32,13 +32,12 @@ ...@@ -32,13 +32,12 @@
# or implied, of GRNET S.A. # or implied, of GRNET S.A.
from optparse import make_option from optparse import make_option
from django.core.management.base import CommandError from snf_django.management.commands import SynnefoCommand, CommandError
from snf_django.management import utils from snf_django.management import utils
from astakos.im.models import Resource from astakos.im.models import Resource
from astakos.im import register from astakos.im import register
from ._common import style_options, check_style, units from ._common import style_options, check_style, units
from snf_django.management.commands import SynnefoCommand
class Command(SynnefoCommand): class Command(SynnefoCommand):
......
...@@ -34,11 +34,10 @@ ...@@ -34,11 +34,10 @@
from optparse import make_option from optparse import make_option
from django.db import transaction from django.db import transaction
from django.core.management.base import CommandError from snf_django.management.commands import SynnefoCommand, CommandError
from django.utils import simplejson as json from django.utils import simplejson as json
from astakos.im.register import add_service, add_resource, RegisterException from astakos.im.register import add_service, add_resource, RegisterException
from snf_django.management.commands import SynnefoCommand
from astakos.im.models import Component from astakos.im.models import Component
from ._common import read_from_file from ._common import read_from_file
......
...@@ -31,10 +31,9 @@ ...@@ -31,10 +31,9 @@
# interpreted as representing official policies, either expressed # interpreted as representing official policies, either expressed
# or implied, of GRNET S.A. # or implied, of GRNET S.A.
from django.core.management.base import CommandError
from astakos.im.models import Service, EndpointData from astakos.im.models import Service, EndpointData
from synnefo.lib.ordereddict import OrderedDict from synnefo.lib.ordereddict import OrderedDict
from snf_django.management.commands import SynnefoCommand from snf_django.management.commands import SynnefoCommand, CommandError
from snf_django.management import utils from snf_django.management import utils
......
...@@ -32,12 +32,9 @@ ...@@ -32,12 +32,9 @@
# or implied, of GRNET S.A. # or implied, of GRNET S.A.
from os.path import abspath from os.path import abspath
from snf_django.management.commands import SynnefoCommand, CommandError
from django.core.management.base import CommandError
from django.db import transaction from django.db import transaction
from astakos.im.models import ApprovalTerms, AstakosUser from astakos.im.models import ApprovalTerms, AstakosUser
from snf_django.management.commands import SynnefoCommand
class Command(SynnefoCommand): class Command(SynnefoCommand):
......
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