コード例 #1
0
ファイル: base.py プロジェクト: thelegend6420/kitsune
 def _guess_migration(self, prefix):
     prefix = Migration.strip_filename(prefix)
     matches = [m for m in self if m.name().startswith(prefix)]
     if len(matches) == 1:
         return matches[0]
     elif len(matches) > 1:
         raise exceptions.MultiplePrefixMatches(prefix, matches)
     else:
         raise exceptions.UnknownMigration(prefix, None)
コード例 #2
0
ファイル: base.py プロジェクト: nranga/django-south
 def migration(self):
     "Tries to load the actual migration module"
     full_name = self.full_name()
     try:
         migration = sys.modules[full_name]
     except KeyError:
         try:
             migration = __import__(full_name, '', '', ['Migration'])
         except ImportError, e:
             raise exceptions.UnknownMigration(self, sys.exc_info())
         except Exception, e:
             raise exceptions.BrokenMigration(self, sys.exc_info())
コード例 #3
0
ファイル: base.py プロジェクト: thelegend6420/kitsune
 def migration(self):
     "Tries to load the actual migration module"
     full_name = self.full_name()
     try:
         migration = sys.modules[full_name]
     except KeyError:
         try:
             migration = __import__(full_name, {}, {}, ['Migration'])
         except ImportError as e:
             raise exceptions.UnknownMigration(self, sys.exc_info())
         except Exception as e:
             raise exceptions.BrokenMigration(self, sys.exc_info())
     # Override some imports
     migration._ = lambda x: x  # Fake i18n
     migration.datetime = datetime_utils
     return migration