当前位置: 首页>>代码示例>>Python>>正文


Python Pool.init方法代码示例

本文整理汇总了Python中trytond.pool.Pool.init方法的典型用法代码示例。如果您正苦于以下问题:Python Pool.init方法的具体用法?Python Pool.init怎么用?Python Pool.init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在trytond.pool.Pool的用法示例。


在下文中一共展示了Pool.init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import init [as 别名]
def run(options):
    database_list = Pool.database_list()
    for dbname in options.database_names:
        thread = _threads.get(dbname)
        if thread and thread.is_alive():
            logger.info('skip "%s" as previous cron still running', dbname)
            continue
        pool = Pool(dbname)
        if dbname not in database_list:
            with Transaction().start(dbname, 0, readonly=True):
                pool.init()
        if not pool.lock.acquire(0):
            logger.warning('can not acquire lock on "%s"', dbname)
            continue
        try:
            try:
                Cron = pool.get('ir.cron')
            except KeyError:
                logger.error(
                    'missing "ir.cron" on "%s"', dbname, exc_info=True)
                continue
        finally:
            pool.lock.release()
        thread = threading.Thread(
                target=Cron.run,
                args=(dbname,), kwargs={})
        logger.info('start thread for "%s"', dbname)
        thread.start()
        _threads[dbname] = thread
开发者ID:coopengo,项目名称:trytond,代码行数:31,代码来源:cron.py

示例2: get_userinfo

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import init [as 别名]
    def get_userinfo(self, user, password, command=''):
        path = urlparse.urlparse(self.path).path
        dbname = urllib.unquote_plus(path.split('/', 2)[1])
        database = Database().connect()
        cursor = database.cursor()
        databases = database.list(cursor)
        cursor.close()
        if not dbname or dbname not in databases:
            return True
        if user:
            user = int(login(dbname, user, password, cache=False))
            if not user:
                return None
        else:
            url = urlparse.urlparse(self.path)
            query = urlparse.parse_qs(url.query)
            path = url.path[len(dbname) + 2:]
            if 'key' in query:
                key, = query['key']
                with Transaction().start(dbname, 0) as transaction:
                    database_list = Pool.database_list()
                    pool = Pool(dbname)
                    if not dbname in database_list:
                        pool.init()
                    Share = pool.get('webdav.share')
                    user = Share.get_login(key, command, path)
                    transaction.cursor.commit()
            if not user:
                return None

        Transaction().start(dbname, user)
        Cache.clean(dbname)
        return user
开发者ID:Sisouvan,项目名称:ogh,代码行数:35,代码来源:webdav.py

示例3: wrapper

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import init [as 别名]
 def wrapper(request, database_name, *args, **kwargs):
     database_list = Pool.database_list()
     pool = Pool(database_name)
     if database_name not in database_list:
         with Transaction().start(
                 database_name, request.user_id, readonly=True):
             pool.init()
     return func(request, pool, *args, **kwargs)
开发者ID:coopengo,项目名称:trytond,代码行数:10,代码来源:dispatcher.py

示例4: create

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import init [as 别名]
def create(database_name, password, lang, admin_password):
    '''
    Create a database

    :param database_name: the database name
    :param password: the server password
    :param lang: the default language for the database
    :param admin_password: the admin password
    :return: True if succeed
    '''
    Database = backend.get('Database')
    security.check_super(password)
    res = False

    try:
        with Transaction().start(None, 0, close=True, autocommit=True) \
                as transaction:
            transaction.database.create(transaction.cursor, database_name)
            transaction.cursor.commit()

        with Transaction().start(database_name, 0) as transaction:
            Database.init(transaction.cursor)
            transaction.cursor.execute(*ir_configuration.insert(
                    [ir_configuration.language], [[lang]]))
            transaction.cursor.commit()

        pool = Pool(database_name)
        pool.init(update=['res', 'ir'], lang=[lang])
        with Transaction().start(database_name, 0) as transaction:
            User = pool.get('res.user')
            Lang = pool.get('ir.lang')
            language, = Lang.search([('code', '=', lang)])
            language.translatable = True
            language.save()
            users = User.search([('login', '!=', 'root')])
            User.write(users, {
                    'language': language.id,
                    })
            admin, = User.search([('login', '=', 'admin')])
            User.write([admin], {
                    'password': admin_password,
                    })
            Module = pool.get('ir.module')
            if Module:
                Module.update_list()
            transaction.cursor.commit()
            res = True
    except Exception:
        logger.error('CREATE DB: %s failed', database_name, exc_info=True)
        raise
    else:
        logger.info('CREATE DB: %s', database_name)
    return res
开发者ID:kret0s,项目名称:gnuhealth-live,代码行数:55,代码来源:dispatcher.py

示例5: transition_upgrade

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import init [as 别名]
 def transition_upgrade(self):
     pool = Pool()
     Module = pool.get('ir.module.module')
     Lang = pool.get('ir.lang')
     with Transaction().new_cursor() as transaction:
         modules = Module.search([
             ('state', 'in', ['to upgrade', 'to remove', 'to install']),
             ])
         langs = Lang.search([
             ('translatable', '=', True),
             ])
         lang = [x.code for x in langs]
         transaction.cursor.commit()
     if modules:
         pool.init(update=True, lang=lang)
     return 'done'
开发者ID:Sisouvan,项目名称:ogh,代码行数:18,代码来源:module.py

示例6: transition_upgrade

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import init [as 别名]
 def transition_upgrade(self):
     pool = Pool()
     Module = pool.get('ir.module')
     Lang = pool.get('ir.lang')
     with Transaction().new_transaction():
         modules = Module.search([
             ('state', 'in', ['to upgrade', 'to remove', 'to install']),
             ])
         update = [m.name for m in modules]
         langs = Lang.search([
             ('translatable', '=', True),
             ])
         lang = [x.code for x in langs]
     if update:
         pool.init(update=update, lang=lang)
         broadcast_init_pool()
     return 'done'
开发者ID:coopengo,项目名称:trytond,代码行数:19,代码来源:module.py

示例7: transition_upgrade

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import init [as 别名]
 def transition_upgrade(self, session):
     pool = Pool()
     module_obj = pool.get('ir.module.module')
     lang_obj = pool.get('ir.lang')
     with Transaction().new_cursor() as transaction:
         module_ids = module_obj.search([
             ('state', 'in', ['to upgrade', 'to remove', 'to install']),
             ])
         lang_ids = lang_obj.search([
             ('translatable', '=', True),
             ])
         lang = [x.code for x in lang_obj.browse(lang_ids)]
         transaction.cursor.commit()
     if module_ids:
         pool.init(update=True, lang=lang)
     if session:
         # Don't store session to prevent concurrent update
         for state_name in session.data:
             getattr(session, state_name).dirty = False
     return 'done'
开发者ID:mediafactory,项目名称:tryton_core_daemon,代码行数:22,代码来源:module.py

示例8: __init__

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import init [as 别名]
class PoolManager:
    def __init__(self, database_name):
        self.database_name = database_name
        
        self.pool = Pool(self.database_name)
        self.pool.init()
        self.pool.start()
        
    def get_pool(self):
        return self.pool
    
    def get_domain(self):
        return self.database_name
        
    def get_table(self, table_name):
        """
        Retrieves a table object from the connection pool
    
        :type:  table_name ``str``
        :param: table_name  the name of the table to retrieve from the connection pool
    
        :return: the ``Table`` object corresponding to the name
        """
        return self.pool.get(table_name).__table__()
开发者ID:kret0s,项目名称:tryton3_8,代码行数:26,代码来源:pool_manager.py

示例9: Exception

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import init [as 别名]
    )
    if answer == 'y':
        IRModule.uninstall(modules)
        print "Please restart this script to continue."
        return False
    else:
        raise Exception('Cannot continue when core module is installed!')


if __name__ == '__main__':
    try:
        DB_NAME = os.environ['DB_NAME']
    except KeyError:
        raise RuntimeError('DB_NAME not found in environment')

    POOL = Pool(DB_NAME)
    POOL.init()

    with Transaction().start(DB_NAME, 1, context={}) as txn:
        Product = Pool().get('product.product')

        rename_string_to_display_name()

        if ensure_core_module_is_installed() is True:

            attribute_kv_map = copy_selection_options()
            for product in Product.search([]):
                validate_and_copy_attributes(product, attribute_kv_map)

        txn.cursor.commit()
开发者ID:PritishC,项目名称:product-attribute-strict,代码行数:32,代码来源:migrate_from_core_module.py

示例10: Nereid

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import init [as 别名]
class Nereid(Flask):
    """
    ...

    Unlike typical web frameworks and their APIs, nereid depends more on
    configuration and not direct python modules written along the APIs
    Most of the functional code will remain on the modules installed on
    Tryton, and the database configurations.

    ...

    """
    #: The class that is used for request objects.  See
    #: :class:`~nereid.wrappers.Request`
    #: for more information.
    request_class = Request

    #: The class that is used for response objects.  See
    #: :class:`~nereid.wrappers.Response` for more information.
    response_class = Response

    #: the session interface to use.  By default an instance of
    #: :class:`~nereid.session.NereidSessionInterface` is used here.
    session_interface = NereidSessionInterface()

    #: An internal attribute to hold the Tryton model pool to avoid being
    #: initialised at every request as it is quite expensive to do so.
    #: To access the pool from modules, use the :meth:`pool`
    _pool = None

    #: The attribute holds a connection to the database backend.
    _database = None

    #: Configuration file for Tryton. The path to the configuration file
    #: can be specified and will be loaded when the application is
    #: initialised
    tryton_configfile = ConfigAttribute('TRYTON_CONFIG')

    #: The location where the translations of the template are stored
    translations_path = ConfigAttribute('TRANSLATIONS_PATH')

    #: The name of the database to connect to on initialisation
    database_name = ConfigAttribute('DATABASE_NAME')

    #: The default timeout to use if the timeout is not explicitly
    #: specified in the set or set many argument
    cache_default_timeout = ConfigAttribute('CACHE_DEFAULT_TIMEOUT')

    #: the maximum number of items the cache stores before it starts
    #: deleting some items.
    #: Applies for: SimpleCache, FileSystemCache
    cache_threshold = ConfigAttribute('CACHE_THRESHOLD')

    #: a prefix that is added before all keys. This makes it possible
    #: to use the same memcached server for different applications.
    #: Applies for: MecachedCache, GAEMemcachedCache
    #: If key_prefix is none the value of site is used as key
    cache_key_prefix = ConfigAttribute('CACHE_KEY_PREFIX')

    #: a list or tuple of server addresses or alternatively a
    #: `memcache.Client` or a compatible client.
    cache_memcached_servers = ConfigAttribute('CACHE_MEMCACHED_SERVERS')

    #: The directory where cache files are stored if FileSystemCache is used
    cache_dir = ConfigAttribute('CACHE_DIR')

    #: The type of cache to use. The type must be a full specification of
    #: the module so that an import can be made. Examples for werkzeug
    #: backends are given below
    #:
    #:  NullCache - werkzeug.contrib.cache.NullCache (default)
    #:  SimpleCache - werkzeug.contrib.cache.SimpleCache
    #:  MemcachedCache - werkzeug.contrib.cache.MemcachedCache
    #:  GAEMemcachedCache -  werkzeug.contrib.cache.GAEMemcachedCache
    #:  FileSystemCache - werkzeug.contrib.cache.FileSystemCache
    cache_type = ConfigAttribute('CACHE_TYPE')

    #: If a custom cache backend unknown to Nereid is used, then
    #: the arguments that are needed for the initialisation
    #: of the cache could be passed here as a `dict`
    cache_init_kwargs = ConfigAttribute('CACHE_INIT_KWARGS')

    #: boolean attribute to indicate if the initialisation of backend
    #: connection and other nereid support features are loaded. The
    #: application can work only after the initialisation is done.
    #: It is not advisable to set this manually, instead call the
    #: :meth:`initialise`
    initialised = False

    #: Prefix the name of the website to the template name sutomatically
    #: This feature would be deprecated in future in lieu of writing
    #: Jinja2 Loaders which could offer this behavior. This is set to False
    #: by default. For backward compatibility of loading templates from
    #: a template folder which has website names as subfolders, set this
    #: to True
    #:
    #: .. versionadded:: 2.8.0.4
    template_prefix_website_name = ConfigAttribute(
        'TEMPLATE_PREFIX_WEBSITE_NAME'
    )
#.........这里部分代码省略.........
开发者ID:NaN-tic,项目名称:nereid,代码行数:103,代码来源:application.py

示例11: dispatch

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import init [as 别名]
def dispatch(host, port, protocol, database_name, user, session, object_type,
        object_name, method, *args, **kargs):

    if object_type == 'common':
        if method == 'login':
            try:
                database = Database(database_name).connect()
                cursor = database.cursor()
                cursor.close()
            except Exception:
                return False
            res = security.login(database_name, user, session)
            Cache.clean(database_name)
            logger = logging.getLogger('dispatcher')
            msg = res and 'successful login' or 'bad login or password'
            logger.info('%s \'%s\' from %s:%d using %s on database \'%s\'' % \
                    (msg, user, host, port, protocol, database_name))
            Cache.resets(database_name)
            return res or False
        elif method == 'logout':
            name = security.logout(database_name, user, session)
            logger = logging.getLogger('dispatcher')
            logger.info('logout \'%s\' from %s:%d ' \
                    'using %s on database \'%s\'' %
                    (name, host, port, protocol, database_name))
            return True
        elif method == 'version':
            return VERSION
        elif method == 'timezone_get':
            return CONFIG['timezone']
        elif method == 'list_lang':
            return [
                ('bg_BG', 'Български'),
                ('ca_ES', 'Català'),
                ('cs_CZ', 'Čeština'),
                ('de_DE', 'Deutsch'),
                ('en_US', 'English'),
                ('es_AR', 'Español (Argentina)'),
                ('es_ES', 'Español (España)'),
                ('es_CO', 'Español (Colombia)'),
                ('fr_FR', 'Français'),
                ('nl_NL', 'Nederlands'),
                ('ru_RU', 'Russian'),
            ]
        elif method == 'db_exist':
            try:
                database = Database(*args, **kargs).connect()
                cursor = database.cursor()
                cursor.close(close=True)
                return True
            except Exception:
                return False
        elif method == 'list':
            if CONFIG['prevent_dblist']:
                raise Exception('AccessDenied')
            database = Database().connect()
            try:
                cursor = database.cursor()
                try:
                    res = database.list(cursor)
                finally:
                    cursor.close(close=True)
            except Exception:
                res = []
            return res
        elif method == 'create':
            return create(*args, **kargs)
        elif method == 'restore':
            return restore(*args, **kargs)
        elif method == 'drop':
            return drop(*args, **kargs)
        elif method == 'dump':
            return dump(*args, **kargs)
        return
    elif object_type == 'system':
        database = Database(database_name).connect()
        database_list = Pool.database_list()
        pool = Pool(database_name)
        if not database_name in database_list:
            pool.init()
        if method == 'listMethods':
            res = []
            for type in ('model', 'wizard', 'report'):
                for object_name, obj in pool.iterobject(type=type):
                    for method in obj._rpc:
                        res.append(type + '.' + object_name + '.' + method)
            return res
        elif method == 'methodSignature':
            return 'signatures not supported'
        elif method == 'methodHelp':
            res = []
            args_list = args[0].split('.')
            object_type = args_list[0]
            object_name = '.'.join(args_list[1:-1])
            method = args_list[-1]
            obj = pool.get(object_name, type=object_type)
            return pydoc.getdoc(getattr(obj, method))

    user = security.check(database_name, user, session)

#.........这里部分代码省略.........
开发者ID:mediafactory,项目名称:tryton_core_daemon,代码行数:103,代码来源:dispatcher.py

示例12: create

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import init [as 别名]
def create(database_name, password, lang, admin_password):
    '''
    Create a database

    :param database_name: the database name
    :param password: the server password
    :param lang: the default language for the database
    :param admin_password: the admin password
    :return: True if succeed
    '''
    security.check_super(password)
    res = False
    logger = logging.getLogger('database')

    try:
        database = Database().connect()
        cursor = database.cursor(autocommit=True)
        try:
            database.create(cursor, database_name)
            cursor.commit()
            cursor.close(close=True)
        except Exception:
            cursor.close()
            raise

        with Transaction().start(database_name, 0) as transaction:
            database.init(transaction.cursor)
            transaction.cursor.commit()

        pool = Pool(database_name)
        pool.init(update=True, lang=[lang])
        with Transaction().start(database_name, 0) as transaction:
            cursor = transaction.cursor
            #XXX replace with model write
            cursor.execute('UPDATE ir_lang ' \
                    'SET translatable = %s ' \
                    'WHERE code = %s', (True, lang))
            cursor.execute('UPDATE res_user ' \
                    'SET language = (' + \
                        cursor.limit_clause('SELECT id FROM ir_lang ' \
                        'WHERE code = %s', 1) + ')' \
                    'WHERE login <> \'root\'', (lang,))
            if hashlib:
                admin_password = hashlib.sha1(admin_password).hexdigest()
            else:
                admin_password = sha.new(admin_password).hexdigest()
            cursor.execute('UPDATE res_user ' \
                    'SET password = %s ' \
                    'WHERE login = \'admin\'', (admin_password,))
            module_obj = pool.get('ir.module.module')
            if module_obj:
                module_obj.update_list()
            cursor.commit()
            res = True
    except Exception:
        logger.error('CREATE DB: %s failed' % (database_name,))
        tb_s = ''.join(traceback.format_exception(*sys.exc_info()))
        logger.error('Exception in call: \n' + tb_s)
        raise
    else:
        logger.info('CREATE DB: %s' % (database_name,))
    return res
开发者ID:mediafactory,项目名称:tryton_core_daemon,代码行数:64,代码来源:dispatcher.py

示例13: len

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import init [as 别名]
    if len(args) != 2:
        parser.error("Expected 2 argument got %d" % len(args))

    if options.config is not None:
        from trytond.config import CONFIG
        CONFIG.configfile = options.config
        CONFIG.load()

    # Register the classes and get all the modules from the pool
    from trytond.modules import register_classes
    register_classes()

    from trytond.pool import Pool
    pool = Pool(args[0])
    pool.init()

    with open(args[1], 'wb') as file:
        base_source = BaseSource.from_tryton_config(args[0])
        file.write(base_source.as_string())

        for model_object in iter_sql_models(pool):
            ds = DataSource.from_model(model_object, base_source)
            if not ds.sql_query:
                # If there are no attributes which have select=1 then there will
                # be no sql query, so just ignore those data sources
                continue
            file.write(ds.as_string())

        file.write(INDEXER_SETTINGS)
        file.write(SEARCHD_SETTINGS)
开发者ID:sharoonthomas,项目名称:tryton_sphinx,代码行数:32,代码来源:tryton-sphinx-buildconf.py

示例14: TestingProxy

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import init [as 别名]
class TestingProxy(object):
    """A collection of helper methods to make testing easier by creating
    a convenience class which could be passed around for testing methods 
    like the one documented below.
    """

    def __init__(self):
        """Required for initialisation and easy access to other members
        """
        self.initialised = False

    def init(self):
        from trytond.config import CONFIG
        CONFIG['database_type'] = 'sqlite'
        self.db_name = ':memory:'

        from trytond.backend import Database
        database = Database()
        cursor = database.cursor()
        databases = database.list(cursor)
        cursor.close()

        if self.db_name not in databases:
            from trytond.protocols.dispatcher import create
            create(self.db_name, 'admin', 'en_US', 'admin')


        self.user = 1
        self.context = None

        from trytond.pool import Pool
        from trytond.transaction import Transaction
        with Transaction().start(self.db_name, self.user, self.context) as txn:
            self.pool = Pool(self.db_name)
            self.pool.init()


        self.initialised = True

    def pool(self):
        from trytond.pool import Pool
        return Pool(self.db_name)

    def drop_database(self):
        """
        Drop the database that was used for testing
        """
        if not self.initialised:
            raise Exception("Cannot drop database when not initialised")
        from trytond.protocols.dispatcher import drop
        drop(self.db_name, 'admin')

    def install_module(self, module):
        if not self.initialised:
            self.init()
        from trytond.transaction import Transaction
        from trytond.pool import Pool
        with Transaction().start(self.db_name, self.user, self.context) as txn:
            module_obj = Pool().get('ir.module.module')
            lang_obj = Pool().get('ir.lang')

            modules = module_obj.search([('name', '=', module)])
            module_obj.install(modules)

            # Find modules to install and trigger pool to update them
            module_ids = module_obj.search([
                ('state', 'in', ['to upgrade', 'to remove', 'to install']),
                ])
            lang_ids = lang_obj.search([
                ('translatable', '=', True),
                ])
            lang = [x.code for x in lang_obj.browse(lang_ids)]
            Pool().init(update=True, lang=lang)
            txn.cursor.commit()

    def register(self, name=None):
        """A decorator that is used to register functions for being attached
        as helper method for testing

        .. code-block:: python

            @testing_proxy.register()
            def create_something(obj, arg):
                pass

        """
        def decorator(f):
            method_name = f.func_name if not name else name
            setattr(self, method_name, new.instancemethod(
                f, self, TestingProxy))
            return f
        return decorator

    def make_app(self, **options):
        """Creates an app with the given options
        """
        from nereid import Nereid as NereidBase
        class Nereid(NereidBase):
            @locked_cached_property
            def jinja_loader(self):
#.........这里部分代码省略.........
开发者ID:shalabhaggarwal,项目名称:nereid,代码行数:103,代码来源:testing.py

示例15: Nereid

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import init [as 别名]
class Nereid(Flask):
    """
    ...

    Unlike typical web frameworks and their APIs, nereid depends more on
    configuration and not direct python modules written along the APIs
    Most of the functional code will remain on the modules installed on
    Tryton, and the database configurations.

    ...

    """
    #: The class that is used for request objects.  See
    #: :class:`~nereid.wrappers.Request`
    #: for more information.
    request_class = Request

    #: The class that is used for response objects.  See
    #: :class:`~nereid.wrappers.Response` for more information.
    response_class = Response

    #: the session interface to use.  By default an instance of
    #: :class:`~nereid.session.NereidSessionInterface` is used here.
    session_interface = NereidSessionInterface()

    #: An internal attribute to hold the Tryton model pool to avoid being
    #: initialised at every request as it is quite expensive to do so.
    #: To access the pool from modules, use the :meth:`pool`
    _pool = None

    #: The attribute holds a connection to the database backend.
    _database = None

    #: Configuration file for Tryton. The path to the configuration file
    #: can be specified and will be loaded when the application is
    #: initialised
    tryton_configfile = ConfigAttribute('TRYTON_CONFIG')

    #: The location where the translations of the template are stored
    translations_path = ConfigAttribute('TRANSLATIONS_PATH')

    #: The name of the database to connect to on initialisation
    database_name = ConfigAttribute('DATABASE_NAME')

    #: The default timeout to use if the timeout is not explicitly
    #: specified in the set or set many argument
    cache_default_timeout = ConfigAttribute('CACHE_DEFAULT_TIMEOUT')

    #: the maximum number of items the cache stores before it starts
    #: deleting some items.
    #: Applies for: SimpleCache, FileSystemCache
    cache_threshold = ConfigAttribute('CACHE_THRESHOLD')

    #: a prefix that is added before all keys. This makes it possible
    #: to use the same memcached server for different applications.
    #: Applies for: MecachedCache, GAEMemcachedCache
    #: If key_prefix is none the value of site is used as key
    cache_key_prefix = ConfigAttribute('CACHE_KEY_PREFIX')

    #: a list or tuple of server addresses or alternatively a
    #: `memcache.Client` or a compatible client.
    cache_memcached_servers = ConfigAttribute('CACHE_MEMCACHED_SERVERS')

    #: The directory where cache files are stored if FileSystemCache is used
    cache_dir = ConfigAttribute('CACHE_DIR')

    #: The type of cache to use. The type must be a full specification of
    #: the module so that an import can be made. Examples for werkzeug
    #: backends are given below
    #:
    #:  NullCache - werkzeug.contrib.cache.NullCache (default)
    #:  SimpleCache - werkzeug.contrib.cache.SimpleCache
    #:  MemcachedCache - werkzeug.contrib.cache.MemcachedCache
    #:  GAEMemcachedCache -  werkzeug.contrib.cache.GAEMemcachedCache
    #:  FileSystemCache - werkzeug.contrib.cache.FileSystemCache
    cache_type = ConfigAttribute('CACHE_TYPE')

    #: If a custom cache backend unknown to Nereid is used, then
    #: the arguments that are needed for the initialisation
    #: of the cache could be passed here as a `dict`
    cache_init_kwargs = ConfigAttribute('CACHE_INIT_KWARGS')

    #: boolean attribute to indicate if the initialisation of backend
    #: connection and other nereid support features are loaded. The
    #: application can work only after the initialisation is done.
    #: It is not advisable to set this manually, instead call the
    #: :meth:`initialise`
    initialised = False

    #: Prefix the name of the website to the template name sutomatically
    #: This feature would be deprecated in future in lieu of writing
    #: Jinja2 Loaders which could offer this behavior. This is set to False
    #: by default. For backward compatibility of loading templates from
    #: a template folder which has website names as subfolders, set this
    #: to True
    #:
    #: .. versionadded:: 2.8.0.4
    template_prefix_website_name = ConfigAttribute(
        'TEMPLATE_PREFIX_WEBSITE_NAME'
    )
#.........这里部分代码省略.........
开发者ID:sharoonthomas,项目名称:nereid,代码行数:103,代码来源:application.py


注:本文中的trytond.pool.Pool.init方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。