~sumanah/mailman/mailman

« back to all changes in this revision

Viewing changes to src/mailman/core/initialize.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) 2006-2014 by the Free Software Foundation, Inc.
 
1
# Copyright (C) 2006-2015 by the Free Software Foundation, Inc.
2
2
#
3
3
# This file is part of GNU Mailman.
4
4
#
24
24
by the command line arguments.
25
25
"""
26
26
 
27
 
from __future__ import absolute_import, print_function, unicode_literals
28
 
 
29
 
__metaclass__ = type
30
27
__all__ = [
31
28
    'initialize',
32
29
    'initialize_1',
38
35
 
39
36
import os
40
37
import sys
41
 
 
42
 
from pkg_resources import resource_string
43
 
from zope.component import getUtility
44
 
from zope.configuration import xmlconfig
45
 
 
46
38
import mailman.config.config
47
39
import mailman.core.logging
48
40
 
49
41
from mailman.interfaces.database import IDatabaseFactory
50
42
from mailman.utilities.modules import call_name
 
43
from pkg_resources import resource_string as resource_bytes
 
44
from zope.component import getUtility
 
45
from zope.configuration import xmlconfig
 
46
 
51
47
 
52
48
# The test infrastructure uses this to prevent the search and loading of any
53
49
# existing configuration file.  Otherwise the existence of say a
76
72
    if os.path.exists(config_path):
77
73
        return config_path
78
74
    # ~/.mailman.cfg
79
 
    config_path = os.path.join(os.getenv('HOME'), '.mailman.cfg')
 
75
    config_path = os.path.join(os.getenv('HOME', '~'), '.mailman.cfg')
80
76
    if os.path.exists(config_path):
81
77
        return os.path.abspath(config_path)
82
78
    # /etc/mailman.cfg
109
105
    :param config_path: The path to the configuration file.
110
106
    :type config_path: string
111
107
    """
112
 
    zcml = resource_string('mailman.config', 'configure.zcml')
113
 
    xmlconfig.string(zcml)
 
108
    zcml = resource_bytes('mailman.config', 'configure.zcml')
 
109
    xmlconfig.string(zcml.decode('utf-8'))
114
110
    # By default, set the umask so that only owner and group can read and
115
111
    # write our files.  Specifically we must have g+rw and we probably want
116
112
    # o-rwx although I think in most cases it doesn't hurt if other can read