Add keyword arguments. Sort arguments and models. Move literals to their own module. Prepend handler_ to signal handlers. Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
43 lines
1.2 KiB
Python
43 lines
1.2 KiB
Python
from __future__ import unicode_literals
|
|
|
|
from django.core import management
|
|
from django.core.management.base import CommandError
|
|
|
|
from ...signals import perform_upgrade, post_upgrade, pre_upgrade
|
|
|
|
|
|
class Command(management.BaseCommand):
|
|
help = 'Performs the required steps after a version upgrade.'
|
|
|
|
def handle(self, *args, **options):
|
|
try:
|
|
pre_upgrade.send(sender=self)
|
|
except Exception as exception:
|
|
raise CommandError(
|
|
'Error during pre_upgrade signal: %s, %s' % (
|
|
exception, type(exception)
|
|
)
|
|
)
|
|
|
|
management.call_command(
|
|
command_name='installjavascript', interactive=False
|
|
)
|
|
|
|
try:
|
|
perform_upgrade.send(sender=self)
|
|
except Exception as exception:
|
|
raise CommandError(
|
|
'Error during perform_upgrade signal; %s, %s' % (
|
|
exception, type(exception)
|
|
)
|
|
)
|
|
|
|
try:
|
|
post_upgrade.send(sender=self)
|
|
except Exception as exception:
|
|
raise CommandError(
|
|
'Error during post_upgrade signal; %s, %s' % (
|
|
exception, type(exception)
|
|
)
|
|
)
|