def start(cls): """ Start/restart the Pool """ with cls._lock: register_classes() cls._started = True
def start(cls): ''' Start/restart the Pool ''' with cls._lock: for classes in Pool.classes.values(): classes.clear() register_classes() cls._started = True
def start(cls): ''' Start/restart the Pool ''' with cls._lock: for classes in Pool.classes.itervalues(): classes.clear() register_classes() cls._started = True
def start(cls): ''' Start/restart the Pool ''' with cls._lock: for classes in Pool.classes.itervalues(): classes.clear() cls._init_hooks = {} register_classes() # AKE: inter-workers communication (start listener) from trytond import iwc iwc.start() cls._started = True
def load_backend(self): """This method loads the configuration file if specified and also connects to the backend, initialising the pool on the go """ if self.tryton_configfile is not None: from trytond.config import CONFIG CONFIG.update_etc(self.tryton_configfile) from trytond.backend import Database from trytond.modules import register_classes register_classes() from trytond.pool import Pool # Load and initialise pool self._database = Database(self.database_name).connect() self._pool = Pool(self.database_name) self._pool.init()
def load_backend(self): """ This method loads the configuration file if specified and also connects to the backend, initialising the pool on the go """ if self.tryton_configfile is not None: warnings.warn(DeprecationWarning( 'TRYTON_CONFIG configuration will be deprecated in future.' )) CONFIG.update_etc(self.tryton_configfile) register_classes() # Load and initialise pool Database = backend.get('Database') self._database = Database(self.database_name).connect() self._pool = Pool(self.database_name) self._pool.init()
def load_backend(self): """ This method loads the configuration file if specified and also connects to the backend, initialising the pool on the go """ if self.tryton_configfile is not None: warnings.warn(DeprecationWarning( 'TRYTON_CONFIG configuration will be deprecated in future.' )) config.update_etc(self.tryton_configfile) register_classes() # Load and initialise pool Database = backend.get('Database') self._database = Database(self.database_name).connect() self._pool = Pool(self.database_name) self._pool.init()
Nereid Payment Gateway Test Suite :copyright: (c) 2010-2012 by Openlabs Technologies & Consulting (P) Ltd. :license: GPLv3, see LICENSE for more details """ import json from decimal import Decimal import unittest2 as unittest from trytond.config import CONFIG CONFIG.options["db_type"] = "sqlite" from trytond.modules import register_classes register_classes() from nereid.testing import testing_proxy from trytond.transaction import Transaction from trytond.pool import Pool class TestPayment(unittest.TestCase): """Test Payment Gateway""" @classmethod def setUpClass(cls): # Install module testing_proxy.install_module("nereid_payment") with Transaction().start(testing_proxy.db_name, 1, None) as txn:
for product_ice_id in set(product_ice_ids) - set(existing_product_ice_ids): create_product.delay(product_ice_id, company) del data if __name__ == '__main__': usage = "Usage: %prog [options] database" parser = OptionParser(usage=usage) parser.add_option("-c", "--config", dest="config", default=None) parser.add_option("-f", "--file", dest="filename", default=None) (options, args) = parser.parse_args() DATABASE = args[0] if options.config: from trytond.config import CONFIG CONFIG.update_etc(options.config) from trytond.modules import register_classes register_classes() from trytond.pool import Pool pool = Pool(DATABASE) pool.init() from trytond.transaction import Transaction with Transaction().start(DATABASE, 1, None) as txn: create_products_from_xml(options.filename) txn.cursor.commit()