LEFT | RIGHT |
1 # Copyright: 2012 MoinMoin:CheerXiao | 1 # Copyright: 2012 MoinMoin:CheerXiao |
2 # Copyright: 2003-2013 MoinMoin:ThomasWaldmann | 2 # Copyright: 2003-2013 MoinMoin:ThomasWaldmann |
3 # Copyright: 2011 MoinMoin:AkashSinha | 3 # Copyright: 2011 MoinMoin:AkashSinha |
4 # Copyright: 2011 MoinMoin:ReimarBauer | 4 # Copyright: 2011 MoinMoin:ReimarBauer |
5 # Copyright: 2008 MoinMoin:FlorianKrupicka | 5 # Copyright: 2008 MoinMoin:FlorianKrupicka |
6 # Copyright: 2010 MoinMoin:DiogenesAugusto | 6 # Copyright: 2010 MoinMoin:DiogenesAugusto |
7 # Copyright: 2001 Richard Jones <richard@bizarsoftware.com.au> | 7 # Copyright: 2001 Richard Jones <richard@bizarsoftware.com.au> |
8 # Copyright: 2001 Juergen Hermann <jh@web.de> | 8 # Copyright: 2001 Juergen Hermann <jh@web.de> |
9 # License: GNU GPL v2 (or any later version), see LICENSE.txt for details. | 9 # License: GNU GPL v2 (or any later version), see LICENSE.txt for details. |
10 | 10 |
(...skipping 2382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2393 | 2393 |
2394 @frontend.route('/+comment', defaults=dict(item_name=u''), methods=['POST']) | 2394 @frontend.route('/+comment', defaults=dict(item_name=u''), methods=['POST']) |
2395 def comment(item_name): | 2395 def comment(item_name): |
2396 itemid = request.form.get('refers_to') | 2396 itemid = request.form.get('refers_to') |
2397 reply_to = request.form.get('reply_to') | 2397 reply_to = request.form.get('reply_to') |
2398 data = request.form.get('data') | 2398 data = request.form.get('data') |
2399 if data: | 2399 if data: |
2400 current_timestamp = datetime.now().strftime("%Y_%m_%d-%H_%M_%S") | 2400 current_timestamp = datetime.now().strftime("%Y_%m_%d-%H_%M_%S") |
2401 item_name = unicode(itemid) + u'/' + u'comment_' + unicode(current_times
tamp) | 2401 item_name = unicode(itemid) + u'/' + u'comment_' + unicode(current_times
tamp) |
2402 item = Item.create(item_name) | 2402 item = Item.create(item_name) |
2403 item.modify({}, data=markdown.markdown(data), element=u'comment', conten
ttype_guessed=u'text/x.moin.wiki;charset=utf-8', \ | 2403 item.modify({}, data=data, element=u'comment', contenttype_guessed=u'tex
t/x-markdown;charset=utf-8', \ |
2404 refers_to=itemid, reply_to=reply_to, author=flaskg.user.name[0]) | 2404 refers_to=itemid, reply_to=reply_to, author=flaskg.user.name[0]) |
2405 html = render_template('comments.html', | 2405 html = render_template('comments.html', |
2406 data=data, | 2406 data=data, |
2407 author=flaskg.user.name[0], | 2407 author=flaskg.user.name[0], |
2408 timestamp=time.ctime(), | 2408 timestamp=time.ctime(), |
2409 commentid=item.fqname.value, | 2409 commentid=item.fqname.value, |
2410 itemid=reply_to, | 2410 itemid=reply_to, |
2411 item=item, | 2411 item=item, |
2412 ) | 2412 ) |
2413 return html | 2413 return html |
2414 | 2414 |
2415 | 2415 |
2416 @frontend.route('/+new', methods=['GET', 'POST']) | 2416 @frontend.route('/+new', methods=['GET', 'POST']) |
2417 def new(): | 2417 def new(): |
2418 # TODO: Implement creation of blog entries and ticket items | 2418 # TODO: Implement creation of blog entries and ticket items |
2419 raise NotImplementedError | 2419 raise NotImplementedError |
2420 | 2420 |
2421 | 2421 |
2422 @frontend.errorhandler(404) | 2422 @frontend.errorhandler(404) |
2423 def page_not_found(e): | 2423 def page_not_found(e): |
2424 return render_template('404.html', | 2424 return render_template('404.html', |
2425 item_name=e.description), 404 | 2425 item_name=e.description), 404 |
LEFT | RIGHT |