Skip to content

Commit

Permalink
Cleanup: Use constants
Browse files Browse the repository at this point in the history
  • Loading branch information
unho committed Apr 23, 2014
1 parent 33e7741 commit 000c415
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions pootle/apps/pootle_app/management/commands/upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
import os
from optparse import make_option

from translate.__version__ import build as code_tt_buildversion
from translate.__version__ import build as CODE_TTK_BUILDVERSION

# This must be run before importing Django.
os.environ['DJANGO_SETTINGS_MODULE'] = 'pootle.settings'

from django.core.management.base import BaseCommand

from pootle.__version__ import build as code_ptl_buildversion
from pootle.__version__ import build as CODE_PTL_BUILDVERSION
from pootle_app.models.pootle_config import get_pootle_build, get_toolkit_build


Expand Down Expand Up @@ -110,29 +110,29 @@ def handle(self, *args, **options):
db_ptl_buildversion = get_pootle_build(DEFAULT_POOTLE_BUILDVERSION)
db_tt_buildversion = get_toolkit_build(DEFAULT_TT_BUILDVERSION)

ptl_changed = db_ptl_buildversion < code_ptl_buildversion
tt_changed = db_tt_buildversion < code_tt_buildversion
ptl_changed = db_ptl_buildversion < CODE_PTL_BUILDVERSION
tt_changed = db_tt_buildversion < CODE_TTK_BUILDVERSION

if ptl_changed or tt_changed:

if ptl_changed:
logging.info('Detected new Pootle version: %d.',
code_ptl_buildversion)
CODE_PTL_BUILDVERSION)
else:
db_ptl_buildversion = 0

if tt_changed:
logging.info('Detected new Translate Toolkit version: %d.',
code_tt_buildversion)
CODE_TTK_BUILDVERSION)
else:
db_tt_buildversion = 0

logging.info('Running the upgrade machinery...')

from pootle_misc.upgrade import upgrade

upgrade('pootle', db_ptl_buildversion, code_ptl_buildversion)
upgrade('ttk', db_tt_buildversion, code_tt_buildversion)
upgrade('pootle', db_ptl_buildversion, CODE_PTL_BUILDVERSION)
upgrade('ttk', db_tt_buildversion, CODE_TTK_BUILDVERSION)

if options['calculate_stats']:
calculate_stats()
Expand All @@ -146,5 +146,5 @@ def handle(self, *args, **options):
'You are already up to date! Current build versions:\n'
'- Pootle: %s\n'
'- Translate Toolkit: %s',
code_ptl_buildversion, code_tt_buildversion,
CODE_PTL_BUILDVERSION, CODE_TTK_BUILDVERSION,
)

0 comments on commit 000c415

Please sign in to comment.