def save_build_versions(): """Save the Pootle and Translate Toolkit build versions on the database. The build versions are used to upgrade only what has to be upgraded. """ pootle_config = PootleConfig(ptl_build=CODE_PTL_BUILD_VERSION, ttk_build=CODE_TTK_BUILD_VERSION) pootle_config.save()
def save_build_versions(): """Save the Pootle and Translate Toolkit build versions on the database. The build versions are used to upgrade only what has to be upgraded. """ pootle_config = PootleConfig( ptl_build=CODE_PTL_BUILD_VERSION, ttk_build=CODE_TTK_BUILD_VERSION ) pootle_config.save()
def ensure_pootle_config(): """Ensure that the PootleConfig object exists, so the code can use it.""" from pootle_app.models import PootleConfig try: PootleConfig.objects.get_current() logging.info("No need to migrate old build versions.") except Exception: from pootle_app.models.pootle_config import (get_legacy_ptl_build, get_legacy_ttk_build) # Copy the Pootle and Translate Toolkit build versions. pootle_config = PootleConfig( ptl_build=get_legacy_ptl_build(), ttk_build=get_legacy_ttk_build(), ) pootle_config.save() logging.info("Succesfully migrated old build versions to new " "PootleConfig.")