def configure_workers(sender=None, conf=None, **kwargs): # The Worker (child process of the celeryd) must have # it's own SQL Connection (A unix forking operation preserve fd) with open(sys.argv[1]) as fdesc: conf = yaml.load(fdesc, YAMLLoader) # XXX Register the database create_engine('pyvac', conf.get('databases').get('pyvac'), scoped=True) if conf.get('ldap'): LdapCache.configure(conf.get('ldap').get('conf')) SmtpCache.configure(conf.get('smtp')) # initialize configuration singleton ConfCache.configure(conf)
def main(argv=sys.argv): if len(argv) != 2: usage(argv) config_uri = argv[1] settings = get_appsettings(config_uri) engine = create_engine('pyvac', settings, scoped=False) config = Configurator(settings=settings) config.end() from pyvac.models import (Base, Permission, Group, User, Request, Countries, VacationType, PasswordRecovery, Sudoer, CPVacation, RTTVacation, RequestHistory) session = DBSession() try: from IPython import embed from IPython.config.loader import Config cfg = Config() cfg.InteractiveShellEmbed.confirm_exit = False embed(config=cfg, banner1="Welcome to pyvac shell.") except ImportError: import code code.interact("pyvac shell", local=locals())
def main(argv=sys.argv): if len(argv) != 2: usage(argv) config_uri = argv[1] setup_logging(config_uri) settings = get_appsettings(config_uri) engine = create_engine('pyvac', settings, scoped=False) populate(engine) dispose_engine('pyvac')
def main(argv=sys.argv): if len(argv) != 2: usage(argv) config_uri = argv[1] setup_logging(config_uri) settings = get_appsettings(config_uri) LdapCache.configure(settings['pyvac.ldap.yaml']) ldap = LdapCache() engine = create_engine('pyvac', settings, scoped=False) populate(engine, ldap) dispose_engine('pyvac')
def main(argv=sys.argv): if len(argv) != 2: usage(argv) config_uri = argv[1] settings = get_appsettings(config_uri) engine = create_engine('pyvac', settings, scoped=False) config = Configurator(settings=settings) config.end() from pyvac.models import Base, Permission, Group, User, Request session = DBSession() try: from IPython import embed from IPython.config.loader import Config cfg = Config() cfg.InteractiveShellEmbed.confirm_exit = False embed(config=cfg, banner1="Welcome to pyvac shell.") except ImportError: import code code.interact("pyvac shell", local=locals())