예제 #1
0
def init_fypress(login='', email='', passwd=''):
    if not passwd or not email or not login:
        print '*** /!\ Usage: python manager.py --login=name [email protected] --passwd=yourpass'
        return False

    user = User.add(login, email, passwd)
    if user:
        user.status   = 4
        user.nicename = user.login
        User.query.update(user)
        print '*** Added user: '******'*** /!\ Invalid user (Duplicate entry)'

    exist = Folder.query.get(1)
    if not exist:
        folder = Folder()
        folder.name     = 'Uncategorized'
        folder.created  = 'NOW()'
        folder.modified = 'NOW()'
        folder.id       = 1
        folder.guid     = ''
        
        Folder.query.add(folder)
        print '*** Added Folder: '+str(folder)

    options = [
        ['name', 'FyPress Site'],
        ['url',  Config.URL],
        ['slogan', 'Welcome to FyPress'],
        ['theme', 'Nyx']
    ]
    for option in options:
        opt = Option.update(option[0], option[1])
        print '*** Added Option: '+str(opt)
예제 #2
0
파일: manager.py 프로젝트: vaniakov/FyPress
def init_fypress(login="", email="", passwd=""):
    if not passwd or not email or not login:
        print "*** /!\ Usage: python manager.py --login=name [email protected] --passwd=yourpass"
        return False

    user = User.add(login, email, passwd)
    if user:
        user.status = 4
        user.nicename = user.login
        User.query.update(user)
        print "*** Added user: "******"*** /!\ Invalid user (Duplicate entry)"

    exist = Folder.query.get(1)
    if not exist:
        folder = Folder()
        folder.name = "Uncategorized"
        folder.created = "NOW()"
        folder.modified = "NOW()"
        folder.id = 1
        folder.guid = ""

        Folder.query.add(folder)
        print "*** Added Folder: " + str(folder)

    options = [["name", "FyPress Site"], ["url", Config.URL], ["slogan", "Welcome to FyPress"], ["theme", "Nyx"]]
    for option in options:
        opt = Option.update(option[0], option[1])
        print "*** Added Option: " + str(opt)
예제 #3
0
파일: views.py 프로젝트: Duncodes/Paipai
def before_request():
    from fypress.user import User
    g.user = None
    if 'user_id' in session:
        g.user = User.query.get(session['user_id'])

    from fypress.admin import Option
    g.options = Option.auto_load()
예제 #4
0
파일: views.py 프로젝트: Duncodes/Paipai
def before_request():
    global options

    if '/public/' not in request.path:
        from fypress.user import User
        g.user = None
        if 'user_id' in session:
            g.user = User.query.get(session['user_id'])

    if len(options) == 0:
        from fypress.admin import Option
        options = Option.auto_load()

    g.options = options
예제 #5
0
파일: views.py 프로젝트: vaniakov/FyPress
def before_request():
    global options

    if '/public/' not in request.path:
        from fypress.user import User
        g.user = None
        if 'user_id' in session:
            g.user = User.query.get(session['user_id'])
        

    if len(options) == 0:
        from fypress.admin import Option
        options = Option.auto_load()

    g.options = options
예제 #6
0
def preview():
    fypress.options['theme'] = request.args.get('theme')
    render = root()
    fypress.options = Option.auto_load()
    return render
예제 #7
0
def before_request():
    if not fypress.options:
        fypress.options = Option.auto_load()