Advertisement
Guest User

Untitled

a guest
Aug 19th, 2011
547
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.83 KB | None | 0 0
  1. from flask import *
  2.  
  3. app = Flask(__name__)
  4. app.jinja_env.trim_blocks = True
  5. app.debug = True
  6.  
  7. @app.route('/')
  8. def index():
  9.     return render_template('home.html')
  10.  
  11. @app.route('/favicon.ico')
  12. def favicon():
  13.     return app.send_static_file('favicon.ico')
  14.  
  15. @app.route('/forum/t_<int:t_id>/')
  16. def f_thread(t_id):
  17.     return '<pre>thread: %d</pre>\n' % t_id
  18.  
  19. @app.route('/forum/t_<int:t_id>/p_<int:p_id>/')
  20. def f_thread_page(t_id, p_id):
  21.     tmp = '<pre>'
  22.     tmp += 'referrer: '+str(request.referrer)+'\n'
  23.     tmp += 'thread: %d\npage: %d\n' % (t_id, p_id)
  24.     tmp += '</pre>\n'
  25.     return tmp
  26.  
  27.  
  28. @app.route('/forum/t_<int:t_id>/c_<int:c_id>/')
  29. def f_thread_comment(t_id, c_id):
  30.     p_id = 2
  31.     return redirect(url_for('f_thread_page', t_id=t_id, p_id=p_id)+'#'+str(c_id))
  32.  
  33. if __name__ == '__main__':
  34.     app.run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement