~abompard/mailman/bug-1312884

« back to all changes in this revision

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

  • Committer: Barry Warsaw
  • Date: 2014-11-01 16:49:15 UTC
  • mfrom: (7251.1.38 abhilash)
  • Revision ID: barry@list.org-20141101164915-06wqfmya6wf47n6n
Database
--------
 * The ORM layer, previously implemented with Storm, has been replaced by
   SQLAlchemy, thanks to the fantastic work by Abhilash Raj and Aurélien
   Bompard.  Alembic is now used for all database schema migrations.
 * The new logger `mailman.database` logs any errors at the database layer.

API
---
 * Several changes to the internal API:
   - `IListManager.mailing_lists` is guaranteed to be sorted in List-ID order.
   - `IDomains.mailing_lists` is guaranteed to be sorted in List-ID order.
   - Iteration over domains via the `IDomainManager` is guaranteed to be sorted
     by `IDomain.mail_host` order.
   - `ITemporaryDatabase` interface and all implementations are removed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
from ConfigParser import SafeConfigParser
34
34
from flufl.lock import Lock
35
35
from lazr.config import ConfigSchema, as_boolean
36
 
from pkg_resources import resource_filename, resource_stream, resource_string
 
36
from pkg_resources import resource_stream, resource_string
37
37
from string import Template
38
38
from zope.component import getUtility
39
39
from zope.event import notify
46
46
    ConfigurationUpdatedEvent, IConfiguration, MissingConfigurationFileError)
47
47
from mailman.interfaces.languages import ILanguageManager
48
48
from mailman.utilities.filesystem import makedirs
49
 
from mailman.utilities.modules import call_name
 
49
from mailman.utilities.modules import call_name, expand_path
50
50
 
51
51
 
52
52
SPACE = ' '
141
141
    def _expand_paths(self):
142
142
        """Expand all configuration paths."""
143
143
        # Set up directories.
144
 
        bin_dir = os.path.abspath(os.path.dirname(sys.argv[0]))
 
144
        bin_dir = os.path.abspath(os.path.dirname(sys.executable))
145
145
        # Now that we've loaded all the configuration files we're going to
146
146
        # load, set up some useful directories based on the settings in the
147
147
        # configuration file.
304
304
    :return: A `ConfigParser` instance.
305
305
    """
306
306
    # Is the context coming from a file system or Python path?
307
 
    if path.startswith('python:'):
308
 
        resource_path = path[7:]
309
 
        package, dot, resource = resource_path.rpartition('.')
310
 
        cfg_path = resource_filename(package, resource + '.cfg')
311
 
    else:
312
 
        cfg_path = path
 
307
    cfg_path = expand_path(path)
313
308
    parser = SafeConfigParser()
314
309
    files = parser.read(cfg_path)
315
310
    if files != [cfg_path]: