~sumanah/mailman/mailman

« back to all changes in this revision

Viewing changes to src/mailman/options.py

  • Committer: Sumana Harihareswara
  • Date: 2015-01-08 21:35:58 UTC
  • mfrom: (7273.2.15 3.0)
  • Revision ID: sumanah@panix.com-20150108213558-65ym6553zj256z8p
mergeĀ fromĀ master

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2008-2014 by the Free Software Foundation, Inc.
 
1
# Copyright (C) 2008-2015 by the Free Software Foundation, Inc.
2
2
#
3
3
# This file is part of GNU Mailman.
4
4
#
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())