Log Message: |
mailer.py: Restore Python 2 support.
* tools/hook-scripts/mailer/mailer.py
():
- Absorb difference of import module name.
- import codecs, to examine equivalence of codecs.
- Don't import locale.
(to_bytes): New function to absorb differnce between Python 2 and Python 3.
Replace occurence of .encode('utf-8') with this whole in this file.
(to_str): New function to absorb difference between Python 2 and Python 3.
Replace occurence of .decode('utf-8') with this whole in this file.
(_stdin): New variable to hold bytes I/O object for stdin
(_stdout): New variable to hold bytes I/O object for stdout
(OutputBase.make_subject):
- Truncate subject by number of bytes, for compatibility before r1884427.
- Truncate subject on character boundary (don't truncate in the middle of
multi-byte sequence of a UTF-8 character).
(StandardOutput.__init__): Use bytes output interface _stdout for
StandardOutput.write_binary.
(StandardOutput.wirte):
- Override this method only if on Python 3 and encoding of stdout is not
'utf-8'
- Use sys.stdout.encoding instead of locale.getpreferredencoding().
(PropChange.generate): Use bytes input interface _stdin.
(Lock.__init__): Use bytes input interface _stdin.
(DiffURLSelections._get_url): Remove extra trailing spaces.
(DiffGenerator.__getitem__): Prepare bytes and str representation of
base_path, 'base_path_bytes' and 'base_path', then use them properly.
|