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)
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())
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