Пример #1
0
def tcg4():
    if not session.get('log'):
        abort(403)
    tags = request.form.get('tcg4')
    try:
        blogInfo().config(tags=tags)
        return "Success"
    except:
        return "Error"
Пример #2
0
def tcg3():
    if not session.get('log'):
        abort(403)
    sidebar = request.form.get('tcg3')
    try:
        blogInfo().config(sidebar=sidebar)
        return "Success"
    except:
        return "Error"
Пример #3
0
def tcg1():
    if not session.get('log'):
        abort(403)
    subtitle = request.form.get('tcg1')
    try:
        blogInfo().config(subtitle=subtitle)
        return "Success"
    except:
        return "Error"
Пример #4
0
def index():
    info=blogInfo()
    curPage = ArtiList(page=1)
    curPage.getAl()
    curPage.getPagn()
    curPage.getRe()
    return render_template('index.html',results = curPage.results, pagn = curPage.pagn,info=info)
Пример #5
0
def login():
    info=blogInfo()
    pwd = request.form.get('password')
    if pwd and info.verify(pwd):
        session['log'] = True
        return redirect(url_for('admin'))
    return render_template('login.html',info=info)
Пример #6
0
def article(bg_id):
    if request.method == 'POST':
        try:
            author = request.form.get('author')
            if not author:
                author = session.get('name')
            if not author:
                author = getName()
            session['name'] = author
            content = request.form.get('content')
            rid = request.form.get('rid',type=int)
            Comment(bg_id).insert(content,author,rid)
            return redirect(url_for('article',bg_id = bg_id))
        except:
            abort(500)
    if bg_id==0:
        return redirect(url_for('memo'))
    try:
        curArti = Article(bg_id)
        curArti.getIt()
    except:
        abort(404)
    if curArti.file!=0 or session.get('log'):
        info=blogInfo()
        info.subtitle=info.title
        info.title=curArti.title
        curComm=Comment(bg_id)
        curComm.getIt()
        return render_template('article.html',curArti = curArti,info=info,cl=curComm.cl)
    abort(404)
Пример #7
0
def cate():
    if not session.get('log'):
        abort(403)
    oldId = request.form.get('oldId',type=int)
    newId = request.form.get('newId',type=int)
    content = request.form.get('content')
    res = blogInfo().setCate(oldId,newId,content)
    return res
Пример #8
0
def tag(tag,pg):
    info=blogInfo()
    curPage = ArtiList('tag',tag,pg)
    if curPage.getPagn():
        curPage.getAl()
        curPage.getRe()
        return render_template('page.html',results = curPage.results, pagn = curPage.pagn,info=info)
    else:
        abort(404)
Пример #9
0
def edit(bg_id):
    if not session.get('log'):
        abort(403)
    try:
        curArti = Article(bg_id)
        curArti.getIt()
    except:
        abort(404)
    return render_template('edit.html',curArti = curArti,info=blogInfo())
Пример #10
0
def tcg2():
    if not session.get('log'):
        abort(403)
    old = request.form.get('old')
    new = request.form.get('new')
    try:
        res = blogInfo().setPwd(old,new)
        return res
    except:
        return "Error"
Пример #11
0
def article(bg_id):
    if bg_id == 0:
        return redirect(url_for('memo'))
    try:
        curArti = Article(bg_id)
        curArti.getIt()
    except:
        abort(404)
    if curArti.file != 0 or session.get('log'):
        info = blogInfo()
        info.subtitle = info.title
        info.title = curArti.title
        curComm = Comment(bg_id)
        curComm.getIt()
        return render_template('article.html',
                               curArti=curArti,
                               info=info,
                               cl=curComm.cl)
    abort(404)
Пример #12
0
def memo():
    curComm=Comment(0)
    curComm.getIt()
    return render_template('memo.html',cl = curComm.cl,info=blogInfo())
Пример #13
0
def internal_server_error(e):
    return render_template('error.html',info=blogInfo()), 500
Пример #14
0
def admin():
    if not session.get('log'):
        return redirect(url_for('login'))
    return render_template('admin.html',info=blogInfo(),cl=Comment().getNew())
Пример #15
0
def bad_request(e):
    return render_template('error.html',info=blogInfo()), 400
Пример #16
0
def page_not_found(e):
    return render_template('error.html' ,info=blogInfo()), 404
Пример #17
0
def new():
    if not session.get('log'):
        abort(403)
    curArti = Article(0)
    return render_template('edit.html',curArti = curArti,info=blogInfo())
Пример #18
0
def forbidden(e):
    return render_template('forbidden.html',info=blogInfo()), 403
Пример #19
0
def wish():
    return render_template('wish.html',info=blogInfo())