/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/errors.py

  • Committer: Jonathan Riddell
  • Date: 2011-09-05 11:36:01 UTC
  • mto: (6123.1.10 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6124.
  • Revision ID: jriddell@canonical.com-20110905113601-mlof6n9vulpggpfm
handle unicode error messages

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
    osutils,
22
22
    symbol_versioning,
23
23
    i18n,
 
24
    trace,
24
25
    )
25
26
from bzrlib.i18n import gettext
26
27
from bzrlib.patches import (
143
144
        fmt = getattr(self, '_fmt', None)
144
145
        if fmt is not None:
145
146
            i18n.install()
146
 
            return gettext(fmt)
 
147
            if type(fmt) == str:
 
148
                unicode_fmt = unicode(fmt, 'utf-8')
 
149
            elif type(fmt) == unicode:
 
150
                trace.mutter("Unicode strings in error.fmt are deprecated")
 
151
                unicode_fmt = fmt
 
152
            return gettext(unicode_fmt).encode('utf-8')
147
153
        fmt = getattr(self, '__doc__', None)
148
154
        if fmt is not None:
149
155
            symbol_versioning.warn("%s uses its docstring as a format, "