Generated: Wed 2013-03-13 10:33 CET
Source file: /media/Envs/Envs/filer-gallery/lib/python2.7/site-packages/south/management/commands/__init__.py
Stats: 0 executed, 12 missed, 6 excluded, 22 ignored
# Common framework for syncdb actionsimport copyfrom django.core import managementfrom django.conf import settings# Make sure the template loader cache is fixed _now_ (#448)import django.template.loaders.app_directoriesfrom south.hacks import hacksfrom south.management.commands.syncdb import Command as SyncCommandclass MigrateAndSyncCommand(SyncCommand): """Used for situations where "syncdb" is called by test frameworks.""" option_list = copy.deepcopy(SyncCommand.option_list) for opt in option_list: if "--migrate" == opt.get_opt_string(): opt.default = True breakdef patch_for_test_db_setup(): # Load the commands cache management.get_commands() # Repoint to the correct version of syncdb if hasattr(settings, "SOUTH_TESTS_MIGRATE") and not settings.SOUTH_TESTS_MIGRATE: # point at the core syncdb command when creating tests # tests should always be up to date with the most recent model structure management._commands['syncdb'] = 'django.core' else: management._commands['syncdb'] = MigrateAndSyncCommand() # Avoid flushing data migrations. # http://code.djangoproject.com/ticket/14661 introduced change that flushed custom # sql during the test database creation (thus flushing the data migrations). # we patch flush to be no-op during create_test_db, but still allow flushing # after each test for non-transactional backends. hacks.patch_flush_during_test_db_creation()