def other_news(page=0): news = M_news.news(int(page)) for new in news['result']: new['_id'] = str(new['_id']) new['date'] = new['date'].strftime("%Y-%m-%d %H:%M:%S") new['comments'] = len(new['comments']) # TODO return {'news': news}
def comments(id_post, *args, **kwargs): tot = M_news.regenerate_comments(id_post) tot['account_type'] = get_cookie('account_type') return draw(view=['comments', 'add_comments'], title="Comments", tot=tot, **kwargs)
def comments(id_post): new = M_news.new_detailed(id_post) new['_id'] = str(new['_id']) new['date'] = new['date'].strftime("%Y-%m-%d %H:%M:%S") for comment in new['comments']: comment['date'] = comment['date'].strftime("%Y-%m-%d %H:%M:%S") return new
def view_tags(page, tags): tags_parse = tags.split('/') news = M_news.tags(tags_parse, int(page)) for new in news['result']: new['_id'] = str(new['_id']) new['date'] = new['date'].strftime("%Y-%m-%d %H:%M:%S") new['comments'] = len(new['comments']) # TODO return {'news': news, 'tags': tags_parse, 'search': True}
def view_tags(tags, page, *args, **kwargs): tags_parse = tags.split('/') return draw(view='news', title="Search tags", tot={'news': M_news.tags(tags_parse, int(page)), 'tags': tags_parse, 'tags_parse': tags_parse, 'search': True}, **kwargs)
def view_tags(tags, page, *args, **kwargs): tags_parse = tags.split('/') return draw(view='news', title="Search tags", tot={ 'news': M_news.tags(tags_parse, int(page)), 'tags': tags_parse, 'tags_parse': tags_parse, 'search': True }, **kwargs)
def new_comment(id_post, *args, **kwargs): M_news.new_comment(id_post, request.forms.get('texto').decode('utf-8'), request.environ.get('REMOTE_ADDR'), *args, **kwargs) return redirect('/comments/' + id_post)
def other_news(page=0, *args, **kwargs): return draw(view='news', title="Home", tot={'news': M_news.news(int(page))}, **kwargs)
def new_comment(id_post, auth_user): M_news.new_comment(id_post, request.forms.get('texto').decode( 'utf-8'), request.environ.get('REMOTE_ADDR'), auth_user) # TODO redirect('/comments/%s' % id_post)
def new_comment(id_post, *args, **kwargs): M_news.new_comment(id_post, request.forms.get('texto').decode( 'utf-8'), request.environ.get('REMOTE_ADDR'), *args, **kwargs) return redirect('/comments/' + id_post)
def new_comment(id_post, auth_user): M_news.new_comment(id_post, request.forms.get('texto').decode('utf-8'), request.environ.get('REMOTE_ADDR'), auth_user) # TODO redirect('/comments/%s' % id_post)