~barry/mailman/lp1423756

« back to all changes in this revision

Viewing changes to src/mailman/options.py

  • Committer: Barry Warsaw
  • Date: 2015-01-05 01:20:33 UTC
  • mfrom: (7264.4.66 py3)
  • Revision ID: barry@list.org-20150105012033-zdrw9c2odhpf22fz
Merge the Python 3 branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
"""Common argument parsing."""
19
19
 
20
 
from __future__ import absolute_import, print_function, unicode_literals
21
 
 
22
 
__metaclass__ = type
23
20
__all__ = [
24
21
    'Options',
25
22
    'SingleMailingListOptions',
31
28
import sys
32
29
 
33
30
from copy import copy
34
 
from optparse import Option, OptionParser, OptionValueError
35
 
 
36
31
from mailman.config import config
37
32
from mailman.core.i18n import _
38
33
from mailman.core.initialize import initialize
39
34
from mailman.version import MAILMAN_VERSION
 
35
from optparse import Option, OptionParser, OptionValueError
40
36
 
41
37
 
42
38
 
43
39
def check_unicode(option, opt, value):
44
40
    """Check that the value is a unicode string."""
45
 
    if isinstance(value, unicode):
 
41
    if not isinstance(value, bytes):
46
42
        return value
47
43
    try:
48
44
        return value.decode(sys.getdefaultencoding())