Ronny Pfannschmidt  committed d8859a8

move most of urls/py to the blueprints

  • Participants
  • Parent commits 42d98c5
  • Branches flask-port

Comments (0)

Files changed (2)

File lodgeit/controllers/

         show_personal='show_personal' in form_args
-def compare_paste(self, new_id=None, old_id=None):
+def compare_paste(new_id=None, old_id=None):
     """Render a diff view for two pastes."""
     getform = local.request.form.get
     # redirect for the compare form box
         diff=old.compare_to(new, template=True)
-def unidiff_paste(self, new_id=None, old_id=None):
+def unidiff_paste(new_id=None, old_id=None):
     """Render an udiff for the two pastes."""
     old = Paste.get(old_id)
     new = Paste.get(new_id)
     return Response(old.compare_to(new), mimetype='text/plain')
-def set_colorscheme(self):
+def set_colorscheme():
     """Minimal view that updates the style session cookie. Redirects
     back to the page the user is coming from.
         resp.set_cookie('style', style_name)
     return resp
-def set_language(self, lang='en'):
+@pastes.route('/language/', defaults={'lang': 'en'})
+def set_language(lang='en'):
     """Minimal view that sets a different language. Redirects
     back to the page the user is coming from."""
     for key, value in i18n_list_languages():
     return redirect(local.request.headers.get('HTTP_REFERER') or local.request.get_url('pastes/new_paste'))
-def show_captcha(self):
+def show_captcha():
     """Show a captcha."""
     return Captcha().get_response(set_cookie=True)

File lodgeit/

 from werkzeug.routing import Map, Rule
 urlmap = Map([
-    # paste interface
-    Rule('/compare/', endpoint='pastes/compare_paste'),
-    Rule('/compare/<new_id>/<old_id>/', endpoint='pastes/compare_paste'),
-    Rule('/unidiff/<new_id>/<old_id>/', endpoint='pastes/unidiff_paste'),
-    Rule('/tree/<identifier>/', endpoint='pastes/show_tree'),
-    # captcha for new paste
-    Rule('/_captcha.png', endpoint='pastes/show_captcha'),
-    # paste list
-    Rule('/all/', endpoint='pastes/show_all'),
-    Rule('/all/<int:page>/', endpoint='pastes/show_all'),
     # xmlrpc and json
     Rule('/xmlrpc/', endpoint='xmlrpc/handle_request'),
     Rule('/json/', endpoint='json/handle_request'),
-    # static pages
-    Rule('/about/', endpoint='static/about'),
-    Rule('/help/', endpoint='static/help'),
-    Rule('/help/<topic>/', endpoint='static/help'),
-    # colorscheme
-    Rule('/colorscheme/', endpoint='pastes/set_colorscheme'),
-    # language
-    Rule('/language/<lang>/', endpoint='pastes/set_language'),
-    # static
-    Rule('/static/<file>', endpoint='static', build_only=True),