예제 #1
0
파일: __init__.py 프로젝트: lansolo99/pyvac
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)
예제 #2
0
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())
예제 #3
0
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')
예제 #4
0
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')
예제 #5
0
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')
예제 #6
0
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')
예제 #7
0
파일: shell.py 프로젝트: grigouze/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())