Example #1
0
def delete_article():
  logged_user = request.get_cookie('account', secret='SECRETKEY')
  id = request.forms.get('id')
  if Article.delete(id):
    return template("view/main.tpl", messages=Article.SCCS_MSGS, user=logged_user)
  else:
    return template("view/delete_article.tpl", messages=Article.ERROR_MSGS, user=logged_user)
Example #2
0
def search():
  author = request.query['name']
  limit = request.query['limit']
  category = request.query['category']
  title = request.query['title']
  year = request.query['year']
  order_by = request.query['order-by']
  order = request.query['order']
  data = Article.find(author, category, title, year, limit, order_by, order)
  return template("view/search_result.tpl", rows=data)
Example #3
0
def new_article():
  logged_user = request.get_cookie('account', secret='SECRETKEY')
  author = request.forms.get('author')
  category = request.forms.get('category')
  summary = request.forms.get('summary')
  title = request.forms.get('title')
  year = request.forms.get('year')
  id = request.forms.get('id')

  if Article.create(author, category, title, year, summary, id):
    return template("view/main.tpl", messages=Article.SCCS_MSGS, user=logged_user)
  else:
    return template("view/new_article.tpl", messages=Article.ERROR_MSGS, user=logged_user)
Example #4
0
def show(id):
  article = Article.find_by_id(id)
  return template("view/article.tpl", article=article)
Example #5
0
def show(id, post):
  id = id + "/" + post
  article = Article.find_by_id(id)
  return template("view/article.tpl", article=article)