~rashi007/mailman/docsfix

« back to all changes in this revision

Viewing changes to src/mailman/config/config.py

  • Committer: Barry Warsaw
  • Date: 2015-01-06 02:12:52 UTC
  • Revision ID: barry@list.org-20150106021252-g1xo6reu6g3c2k63
We don't need the lazr.config workaround any more.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
import sys
29
29
import mailman.templates
30
30
 
31
 
from configparser import ConfigParser, RawConfigParser
 
31
from configparser import ConfigParser
32
32
from flufl.lock import Lock
33
33
from lazr.config import ConfigSchema, as_boolean
34
34
from mailman import version
39
39
from mailman.utilities.modules import call_name, expand_path
40
40
from pkg_resources import resource_filename, resource_string as resource_bytes
41
41
from string import Template
42
 
from unittest.mock import patch
43
42
from zope.component import getUtility
44
43
from zope.event import notify
45
44
from zope.interface import implementer
64
63
# enabled: yes
65
64
# recipient: your.address@your.domain"""
66
65
 
67
 
class _NonStrictRawConfigParser(RawConfigParser):
68
 
    def __init__(self, *args, **kws):
69
 
        kws['strict'] = False
70
 
        super().__init__(*args, **kws)
71
 
 
72
66
 
73
67
 
74
68
@implementer(IConfiguration)
122
116
    def push(self, config_name, config_string):
123
117
        """Push a new configuration onto the stack."""
124
118
        self._clear()
125
 
        # In Python 3, the RawConfigParser() must be created with
126
 
        # strict=False, otherwise we'll get a DuplicateSectionError.
127
 
        # See https://bugs.launchpad.net/lazr.config/+bug/1397779
128
 
        with patch('lazr.config._config.RawConfigParser',
129
 
                   _NonStrictRawConfigParser):
130
 
            self._config.push(config_name, config_string)
 
119
        self._config.push(config_name, config_string)
131
120
        self._post_process()
132
121
 
133
122
    def pop(self, config_name):