Esempio n. 1
0
def index(request):
    if request.method == 'POST':
        form = MPConfigForm(request.POST)
        if form.is_valid():
            rs.hmset("MoePadConf", request.POST)
        return render(request, "index.html", {"form": form})
    else:
        data = rs.hgetall("MoePadConf")
        form = MPConfigForm(initial=data)
        return render(request, "index.html", {"form": form})
Esempio n. 2
0
def index(request):
    if request.method == 'POST':
        form = MPConfigForm(request.POST)
        if form.is_valid():
            rs.hmset("MoePadConf", request.POST)
        return render(request, "index.html", {"form": form})
    else:
        data = rs.hgetall("MoePadConf")
        form = MPConfigForm(initial=data)
        return render(request, "index.html", {"form": form})
Esempio n. 3
0
def confData(request):
    mpconfig.MoePadConfKey = "MoePadConfTest"
    rs.hmset(
        mpconfig.MoePadConfKey, {
            "sameItemInterval": '24',
            "Domain": "www.pythonik.com",
            "SinaAppSecret": "c146e4d5772bf6a3363d9c804ed2c128",
            "SinaAppKey": "255208104",
            "TencentAppKey": "255208102",
            "TencentAppSecret": "c146e4d5772bf6a3363d9c804ed2c129",
        })

    @request.addfinalizer
    def teardown():
        rs.delete(mpconfig.MoePadConfKey)

    return mpconfig.MpConfigRedisHandler()
Esempio n. 4
0
def confData(request):
    mpconfig.MoePadConfKey = "MoePadConfTest"
    rs.hmset(mpconfig.MoePadConfKey,
             {
                 "sameItemInterval": '24',
                 "Domain": "www.pythonik.com",
                 "SinaAppSecret": "c146e4d5772bf6a3363d9c804ed2c128",
                 "SinaAppKey": "255208104",
                 "TencentAppKey": "255208102",
                 "TencentAppSecret": "c146e4d5772bf6a3363d9c804ed2c129",
             })

    @request.addfinalizer
    def teardown():
        rs.delete(mpconfig.MoePadConfKey)

    return mpconfig.MpConfigRedisHandler()