Пример #1
0
 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}
Пример #2
0
Файл: news.py Проект: agalera/n3
 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)
Пример #3
0
 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
Пример #4
0
 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}
Пример #5
0
 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
Пример #6
0
 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}
Пример #7
0
 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)
Пример #8
0
 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}
Пример #9
0
Файл: news.py Проект: agalera/n3
 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)
Пример #10
0
Файл: news.py Проект: agalera/n3
 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)
Пример #11
0
Файл: news.py Проект: agalera/n3
 def other_news(page=0, *args, **kwargs):
     return draw(view='news',
                 title="Home",
                 tot={'news': M_news.news(int(page))},
                 **kwargs)
Пример #12
0
 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)
Пример #13
0
 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)
Пример #14
0
 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)
Пример #15
0
 def other_news(page=0, *args, **kwargs):
     return draw(view='news', title="Home", tot={'news': M_news.news(int(page))},
                 **kwargs)
Пример #16
0
 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)