def initialize(config = None): """Initialize the module with specific or default config""" # initialize the cache cache.initialize(config) # initialize the translator translator.initialize(config)
import config import util import cache import random import ldap import socket import debuglog defaultConf="""<profiles> <default profile=""/> </profiles>""" # make sure to initialize the cache first # this will make sure we can handle disconnection # and initialize libxml2 environment cache.initialize() def dprint (fmt, *args): debuglog.debug_log (False, debuglog.DEBUG_LOG_DOMAIN_USER_DB, fmt % args) def get_setting (node, setting, default = None, convert_to = str): a = node.hasProp(setting) if a: try: return convert_to (a.content) except: np = node.nodePath() # Translators: You may move the "%(setting)s" and "%(np)s" items as you wish, but # do not change the way they are written. The intended string is # something like "invalid type for setting blah in /ldap/path/to/blah" raise UserDatabaseException(_("invalid type for setting %(setting)s in %(np)s") % { "setting": setting,