goa/skel/loader.py
author sylvain.thenault@logilab.fr
Tue, 17 Feb 2009 16:41:46 +0100
branchtls-sprint
changeset 664 04154a2b238d
parent 0 b97547f5f1fa
child 1802 d628defebc17
permissions -rw-r--r--
drop unused support of .required, no more necessary .accepts check, and extresources_registerer

if __name__ == '__main__':

    from os.path import dirname, abspath
    from cubicweb import goa
    from cubicweb.goa.goaconfig import GAEConfiguration
    from cubicweb.goa.dbinit import create_user, create_groups
    
    # compute application's root directory
    APPLROOT = dirname(abspath(__file__))
    # apply monkey patches first
    goa.do_monkey_patch()
    # get application's configuration (will be loaded from app.conf file)
    GAEConfiguration.ext_resources['JAVASCRIPTS'].append('DATADIR/goa.js')
    config = GAEConfiguration('toto', APPLROOT)
    # create default groups
    create_groups()
    if not config['use-google-auth']:
        # create default admin
        create_user('admin', 'admin', ('managers', 'users'))
        # create anonymous user if specified
        anonlogin = config['anonymous-user']
        if anonlogin:
            create_user(anonlogin, config['anonymous-password'], ('guests',))
    print 'content initialized'