~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

  • Committer: John Arbash Meinel
  • Date: 2010-01-05 04:30:07 UTC
  • mfrom: (4932 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4934.
  • Revision ID: john@arbash-meinel.com-20100105043007-ehgbldqd3q0gtyws
Merge bzr.dev, resolve conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2087
2087
    if use_cache:
2088
2088
        _cached_concurrency = concurrency
2089
2089
    return concurrency
 
2090
 
 
2091
 
 
2092
class UnicodeOrBytesToBytesWriter(codecs.StreamWriter):
 
2093
    """A stream writer that doesn't decode str arguments."""
 
2094
 
 
2095
    def __init__(self, encode, stream, errors='strict'):
 
2096
        codecs.StreamWriter.__init__(self, stream, errors)
 
2097
        self.encode = encode
 
2098
 
 
2099
    def write(self, object):
 
2100
        if type(object) is str:
 
2101
            self.stream.write(object)
 
2102
        else:
 
2103
            data, _ = self.encode(object, self.errors)
 
2104
            self.stream.write(data)