示例#1
0
    def __init__(self):
        """initialize cabochon utility with portal context"""

        # get the cabochon username and password
        cabochon_user_info_file = product_config("cabochon_user_info", "opencore.nui")
        if not cabochon_user_info_file:
            raise CabochonConfigError("no cabochon_user_info file specified in zope.conf opencore.nui")

        try:
            f = open(cabochon_user_info_file)
            username, password = f.read().strip().split(":", 1)
            f.close()
        except IOError:
            raise CabochonConfigError("bad cabochon_user_info file specified in zope.conf opencore.nui")

        # get cabochon_messages filesystem location from configuration
        cabochon_messages_dir = product_config("cabochon_messages", "opencore.nui")
        if not cabochon_messages_dir:
            raise CabochonConfigError("no cabochon_messages directory specified in zope.conf opencore.nui")

        # Stash config settings for later.
        self.cabochon_messages_dir = cabochon_messages_dir
        self.username = username
        self.password = password
        self.lock = Lock()
示例#2
0
def email_confirmation(is_test=False):
    """get email confirmation mode from zope.conf"""
    if is_test:
        return True
    conf = product_config('email-confirmation', 'opencore.nui')
    if conf:
        val = conf.title()
        if val == 'True':
            return True
        elif val == 'False':
            return False
        else:
            raise ValueError('email-confirmation should be "True" or "False"')
    return True # the default
def get_secret_file_name():
    filename = conf_utils.product_config('topp_secret_filename', 'opencore.auth')
    if filename:
        return filename
    return os.path.join(os.environ.get('INSTANCE_HOME'), 'secret.txt')
示例#4
0
def get_secret_filename():
    filename = conf_utils.product_config('listen_secret_filename', 'opencore.listen')
    if not filename:
        filename = os.path.join(os.environ.get('INSTANCE_HOME', 'listen_secret.txt'))
    return filename