south.exceptions: 92 total statements, 0.0% covered

Generated: Wed 2013-03-13 10:33 CET

Source file: /media/Envs/Envs/filer-gallery/lib/python2.7/site-packages/south/exceptions.py

Stats: 0 executed, 91 missed, 1 excluded, 59 ignored

  1. from traceback import format_exception
  2. class SouthError(RuntimeError):
  3. pass
  4. class SouthWarning(RuntimeWarning):
  5. pass
  6. class BrokenMigration(SouthError):
  7. def __init__(self, migration, exc_info):
  8. self.migration = migration
  9. self.exc_info = exc_info
  10. if self.exc_info:
  11. self.traceback = ''.join(format_exception(*self.exc_info))
  12. def __str__(self):
  13. return ("While loading migration '%(migration)s':\n"
  14. '%(traceback)s' % self.__dict__)
  15. class UnknownMigration(BrokenMigration):
  16. def __str__(self):
  17. return ("Migration '%(migration)s' probably doesn't exist.\n"
  18. '%(traceback)s' % self.__dict__)
  19. class InvalidMigrationModule(SouthError):
  20. def __init__(self, application, module):
  21. self.application = application
  22. self.module = module
  23. def __str__(self):
  24. return ('The migration module specified for %(application)s, %(module)r, is invalid; the parent module does not exist.' % self.__dict__)
  25. class NoMigrations(SouthError):
  26. def __init__(self, application):
  27. self.application = application
  28. def __str__(self):
  29. return "Application '%(application)s' has no migrations." % self.__dict__
  30. class MultiplePrefixMatches(SouthError):
  31. def __init__(self, prefix, matches):
  32. self.prefix = prefix
  33. self.matches = matches
  34. def __str__(self):
  35. self.matches_list = "\n ".join([unicode(m) for m in self.matches])
  36. return ("Prefix '%(prefix)s' matches more than one migration:\n"
  37. " %(matches_list)s") % self.__dict__
  38. class GhostMigrations(SouthError):
  39. def __init__(self, ghosts):
  40. self.ghosts = ghosts
  41. def __str__(self):
  42. self.ghosts_list = "\n ".join([unicode(m) for m in self.ghosts])
  43. return ("\n\n ! These migrations are in the database but not on disk:\n"
  44. " %(ghosts_list)s\n"
  45. " ! I'm not trusting myself; either fix this yourself by fiddling\n"
  46. " ! with the south_migrationhistory table, or pass --delete-ghost-migrations\n"
  47. " ! to South to have it delete ALL of these records (this may not be good).") % self.__dict__
  48. class CircularDependency(SouthError):
  49. def __init__(self, trace):
  50. self.trace = trace
  51. def __str__(self):
  52. trace = " -> ".join([unicode(s) for s in self.trace])
  53. return ("Found circular dependency:\n"
  54. " %s") % trace
  55. class InconsistentMigrationHistory(SouthError):
  56. def __init__(self, problems):
  57. self.problems = problems
  58. def __str__(self):
  59. return ('Inconsistent migration history\n'
  60. 'The following options are available:\n'
  61. ' --merge: will just attempt the migration ignoring any potential dependency conflicts.')
  62. class DependsOnHigherMigration(SouthError):
  63. def __init__(self, migration, depends_on):
  64. self.migration = migration
  65. self.depends_on = depends_on
  66. def __str__(self):
  67. return "Lower migration '%(migration)s' depends on a higher migration '%(depends_on)s' in the same app." % self.__dict__
  68. class DependsOnUnknownMigration(SouthError):
  69. def __init__(self, migration, depends_on):
  70. self.migration = migration
  71. self.depends_on = depends_on
  72. def __str__(self):
  73. print "Migration '%(migration)s' depends on unknown migration '%(depends_on)s'." % self.__dict__
  74. class DependsOnUnmigratedApplication(SouthError):
  75. def __init__(self, migration, application):
  76. self.migration = migration
  77. self.application = application
  78. def __str__(self):
  79. return "Migration '%(migration)s' depends on unmigrated application '%(application)s'." % self.__dict__
  80. class FailedDryRun(SouthError):
  81. def __init__(self, migration, exc_info):
  82. self.migration = migration
  83. self.name = migration.name()
  84. self.exc_info = exc_info
  85. self.traceback = ''.join(format_exception(*self.exc_info))
  86. def __str__(self):
  87. return (" ! Error found during dry run of '%(name)s'! Aborting.\n"
  88. "%(traceback)s") % self.__dict__
  89. class ORMBaseNotIncluded(SouthError):
  90. """Raised when a frozen model has something in _ormbases which isn't frozen."""
  91. pass
  92. class UnfreezeMeLater(Exception):
  93. """An exception, which tells the ORM unfreezer to postpone this model."""
  94. pass
  95. class ImpossibleORMUnfreeze(SouthError):
  96. """Raised if the ORM can't manage to unfreeze all the models in a linear fashion."""
  97. pass
  98. class ConstraintDropped(SouthWarning):
  99. def __init__(self, constraint, table, column=None):
  100. self.table = table
  101. if column:
  102. self.column = ".%s" % column
  103. else:
  104. self.column = ""
  105. self.constraint = constraint
  106. def __str__(self):
  107. return "Constraint %(constraint)s was dropped from %(table)s%(column)s -- was this intended?" % self.__dict__