# Path: moedjpack/moepad/mputils.py
# def sub_dict(somedict, somekeys, default=None):
# def loggerInit(logfile):
# def utcnow():
# def _deletePrefix(key):
# def create_default_db():


import feedparser
import datetime
import logging
import redis
import json
from django.http import HttpResponse, Http404
from django.shortcuts import *
from django.contrib.auth.decorators import login_required
from django.views.decorators.csrf import csrf_exempt
from django.contrib.auth.forms import UserCreationForm
from forms import MPConfigForm, ForbiddenForm
from moedjpack.moepad.mputils import rs
from moedjpack.moepad.mpdefs import *

            form.save()  # new user created
            return HttpResponseRedirect("/accounts/login/")
    else:
        form = UserCreationForm()
    return render_to_response("registration/register.html",
                              {'form': form},
                              context_instance=RequestContext(request))


@login_required
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})


@login_required
def forbidden_proc(request):
    print request.GET
    if request.method == 'POST':
        forbidden_keywords = request.POST['keywords'].split(',')
        f_set = set(forbidden_keywords)
        f_set.discard("")
        if f_set:

# Path: moedjpack/moepad/mputils.py
# def sub_dict(somedict, somekeys, default=None):
# def loggerInit(logfile):
# def utcnow():
# def _deletePrefix(key):
# def create_default_db():


# Path: moedjpack/moewiki/views.py
import feedparser
import datetime
import logging
import redis
import json
from django.http import HttpResponse, Http404
from django.shortcuts import *
from django.contrib.auth.decorators import login_required
from django.views.decorators.csrf import csrf_exempt
from django.contrib.auth.forms import UserCreationForm
from forms import MPConfigForm, ForbiddenForm
from moedjpack.moepad.mputils import rs
from moedjpack.moepad.mpdefs import *

            form.save()  # new user created
            return HttpResponseRedirect("/accounts/login/")
    else:
        form = UserCreationForm()
    return render_to_response("registration/register.html",
                              {'form': form},
                              context_instance=RequestContext(request))


@login_required
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})


@login_required
def forbidden_proc(request):
    print request.GET
    if request.method == 'POST':
        forbidden_keywords = request.POST['keywords'].split(',')
        f_set = set(forbidden_keywords)
        f_set.discard("")
        if f_set:

            for keyword in f_set:
