コード例 #1
0
ファイル: house.py プロジェクト: hephaestus9/Ironworks
def pyemon_input():
    if 'username' in session:
        inputModel = input_model.Input()
        loginStatus = serverTools.getPyEmoncmsLogin()
        inputNames = []
        if loginStatus["status"] is False:
            return redirect(url_for('houseLogin'))

        userModel = user_model.User()
        user = serverTools.getPyEmoncmsLogin()
        userId = str(userModel.get_id(user["user"]))
        inputs = inputModel.getList(userId)
        for uniqueInput in inputs:
            for key in list(uniqueInput.keys()):
                inputNames.append(key)
        user = userModel.get_user(userId)
        username = user[1]
        email = user[2]
        writeKey = user[3]
        readKey = user[4]

        return render_template('house/pyemoncms/input.html',
                               inputs=inputs,
                               inputNames=inputNames,
                               username=username,
                               email=email,
                               writeKey=writeKey,
                               readKey=readKey)
    return render_template('index.html')
コード例 #2
0
ファイル: house.py プロジェクト: hephaestus9/Ironworks
def pyemon_docs():
    if 'username' in session:
        status = serverTools.getPyEmoncmsLogin()
        if status["status"] is False:
            return redirect(url_for('houseLogin'))

        userModel = user_model.User()
        user = serverTools.getPyEmoncmsLogin()
        userId = userModel.get_id(user["user"])
        user = userModel.get_user(userId)
        username = user[1]
        email = user[2]
        writeKey = user[3]
        readKey = user[4]
        return render_template('house/pyemoncms/docs.html',
                               username=username,
                               email=email,
                               writeKey=writeKey,
                               readKey=readKey)
    return render_template('index.html')
コード例 #3
0
ファイル: house.py プロジェクト: hephaestus9/Ironworks
def pyemon_user():
    if 'username' in session:
        status = serverTools.getPyEmoncmsLogin()
        if status["status"] is False:
            return redirect(url_for('houseLogin'))

        userModel = user_model.User()
        user = serverTools.getPyEmoncmsLogin()
        userId = userModel.get_id(user["user"])
        user = userModel.get_user(userId)
        username = user[1]
        email = user[2]
        writeKey = user[3]
        readKey = user[4]
        location = user[7]
        if int(user[8]) >= 0:
            timezone = "UTC +" + str(user[8])
        else:
            timezone = "UTC " + str(user[8])
        if user[9] == 'en_EN':
            language = 'American English'
        if user[10] is None:
            bio = ""
        else:
            bio = user[10]
        avatar = user[11]
        return render_template('house/pyemoncms/user.html',
                               username=username,
                               email=email,
                               writeKey=writeKey,
                               readKey=readKey,
                               location=location,
                               timezone=timezone,
                               language=language,
                               bio=bio,
                               avatar=avatar)
    return render_template('index.html')