Ticket #1024 (accepted defect)

Opened 2 years ago

Last modified 2 years ago

retry_failed_fields methods fails to produce meaningfull error if exception message contains unicode chars

Reported by: jbzdak@… Owned by: andrew
Priority: major Milestone: 1.0
Component: commands Version: unknown
Keywords: Cc:


Method south.orm.FakeOrm.retry_failed_field fails to produce meaningfull error if field raises exception that contains unicode chars during creation.

Faulty code is

       field = self.eval_in_context(code, app, extra_imports)
   except (NameError, AttributeError, AssertionError, KeyError), e:
       # It's failed again. Complain.
       raise ValueError("Cannot successfully create field '%s' for model '%s': %s." % (
           fname, modelname, e

You should either use unicode pattern:

raise ValueError(u"Cannot successfully create field '%s' for model '%s': %s." % (
           fname, modelname, e

or use repr:

raise ValueError(u"Cannot successfully create field '%s' for model '%s': %s." % (
           fname, modelname, repr(e)

Full stack trace:

Traceback (most recent call last):
  File "/home/jb/ides/pycharm-2.0.1/helpers/pydev/", line 1325, in <module>['file'], None, None)
  File "/home/jb/ides/pycharm-2.0.1/helpers/pydev/", line 1033, in run
    pydev_imports.execfile(file, globals, locals) #execute the script
  File "/home/jb/programs/drat/hajmon/hajmondjango/", line 15, in <module>
  File "/usr/lib/python2.6/dist-packages/django/core/management/", line 438, in execute_manager
  File "/usr/lib/python2.6/dist-packages/django/core/management/", line 379, in execute
  File "/usr/lib/python2.6/dist-packages/django/core/management/", line 191, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/lib/python2.6/dist-packages/django/core/management/", line 220, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python2.6/dist-packages/South-0.7.3-py2.6.egg/south/management/commands/", line 105, in handle
    ignore_ghosts = ignore_ghosts,
  File "/usr/local/lib/python2.6/dist-packages/South-0.7.3-py2.6.egg/south/migration/", line 191, in migrate_app
    success = migrator.migrate_many(target, workplan, database)
  File "/usr/local/lib/python2.6/dist-packages/South-0.7.3-py2.6.egg/south/migration/", line 221, in migrate_many
    result = migrator.__class__.migrate_many(migrator, target, migrations, database)
  File "/usr/local/lib/python2.6/dist-packages/South-0.7.3-py2.6.egg/south/migration/", line 292, in migrate_many
    result = self.migrate(migration, database)
  File "/usr/local/lib/python2.6/dist-packages/South-0.7.3-py2.6.egg/south/migration/", line 125, in migrate
    result =
  File "/usr/local/lib/python2.6/dist-packages/South-0.7.3-py2.6.egg/south/migration/", line 93, in run
    south.db.db.current_orm = self.orm(migration)
  File "/usr/local/lib/python2.6/dist-packages/South-0.7.3-py2.6.egg/south/migration/", line 246, in orm
    return migration.orm()
  File "/usr/local/lib/python2.6/dist-packages/South-0.7.3-py2.6.egg/south/", line 62, in method
    value = function(self)
  File "/usr/local/lib/python2.6/dist-packages/South-0.7.3-py2.6.egg/south/migration/", line 422, in orm
    return FakeORM(self.migration_class(), self.app_label())
  File "/usr/local/lib/python2.6/dist-packages/South-0.7.3-py2.6.egg/south/", line 46, in FakeORM
    _orm_cache[args] = _FakeORM(*args)  
  File "/usr/local/lib/python2.6/dist-packages/South-0.7.3-py2.6.egg/south/", line 132, in __init__
  File "/usr/local/lib/python2.6/dist-packages/South-0.7.3-py2.6.egg/south/", line 371, in retry_failed_fields
    fname, modelname, e


Change History

comment:1 Changed 2 years ago by andrew

  • Status changed from new to accepted
  • Milestone set to 1.0

Add a comment

Modify Ticket

as accepted

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.