~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/errors.py

  • Committer: Jelmer Vernooij
  • Date: 2011-09-26 11:00:20 UTC
  • mfrom: (6167 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6169.
  • Revision ID: jelmer@samba.org-20110926110020-g86tgisgnuajlc2n
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
from bzrlib import (
21
21
    osutils,
22
22
    symbol_versioning,
 
23
    i18n,
 
24
    trace,
23
25
    )
 
26
from bzrlib.i18n import gettext
24
27
from bzrlib.patches import (
25
28
    MalformedHunkHeader,
26
29
    MalformedLine,
140
143
        """Return format string for this exception or None"""
141
144
        fmt = getattr(self, '_fmt', None)
142
145
        if fmt is not None:
143
 
            return fmt
 
146
            i18n.install()
 
147
            unicode_fmt = unicode(fmt) #_fmt strings should be ascii
 
148
            if type(fmt) == unicode:
 
149
                trace.mutter("Unicode strings in error.fmt are deprecated")
 
150
            return gettext(unicode_fmt)
144
151
        fmt = getattr(self, '__doc__', None)
145
152
        if fmt is not None:
146
153
            symbol_versioning.warn("%s uses its docstring as a format, "
2349
2356
    """
2350
2357
 
2351
2358
 
 
2359
class GhostTagsNotSupported(BzrError):
 
2360
 
 
2361
    _fmt = "Ghost tags not supported by format %(format)r."
 
2362
 
 
2363
    def __init__(self, format):
 
2364
        self.format = format
 
2365
 
 
2366
 
2352
2367
class BinaryFile(BzrError):
2353
2368
 
2354
2369
    _fmt = "File is binary but should be text."
2784
2799
    _fmt = "Container has multiple records with the same name: %(name)s"
2785
2800
 
2786
2801
    def __init__(self, name):
2787
 
        self.name = name
 
2802
        self.name = name.decode("utf-8")
2788
2803
 
2789
2804
 
2790
2805
class NoDestinationAddress(InternalBzrError):