def setup_env(): class env: pass env.config = readconf.parse_config() use_gevent = not env.config.threaded localprov = setup_process_model(use_gevent) commonlib.helpers.random_key_gen = commonlib.helpers.RandomKeyFactory(env.config.random_str) env.mailer = commonlib.messaging.email.Mailer(env.config.mail) env.mailer.start() env.context = localprov.local() commonlib.helpers.push_to_builtins('env', env) return env
def setup_env(conf): class env: pass try: conf_local = __import__(conf) except Exception as err: print(err) conf_local = None env.config = readconf.parse_config(conf_default, conf_local) commonlib.helpers.random_key_gen = commonlib.helpers.RandomKeyFactory(env.config.random_str) #env.mailer = commonlib.messaging.email.Mailer(env.config.mail) #env.mailer.start() env.context = localprov.local() builtins.env = env return env
def set_rst_prolog(): import sys sys.path.insert(0, '../..') # add cowspa dir to module search path import commonlib.readconf as readconf config = readconf.parse_config() network = config.words['NETWORK'] bizplace = config.words['BIZPLACE'] product = config.words['PRODUCT'] prolog_1 = ".. |NETWORK| replace:: '%s'\n" % network prolog_2 = ".. |BIZPLACE| replace:: '%s'\n" % bizplace prolog_3 = ".. |PRODUCT| replace:: '%s'\n" % product prolog = prolog_1 + prolog_2 + prolog_3 return prolog