git @ Cat's Eye Technologies klaus / redirect-to-raw-with-qsarg
Have ?raw=true in querystring on blob view redirect to raw view. Chris Pressey 1 year, 11 months ago
1 changed file(s) with 7 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
11 import os
22 import sys
33
4 from flask import request, render_template, current_app, url_for
4 from flask import request, render_template, current_app, url_for, redirect
55 from flask.views import View
66
77 from werkzeug.wrappers import Response
394394 """Shows a file rendered using ``pygmentize``."""
395395 template_name = 'view_blob.html'
396396
397
398 def dispatch_request(self, repo, rev=None, path=''):
399 if 'raw' in request.args:
400 return redirect(url_for('raw', repo=repo, rev=rev, path=path))
401 return super(FileView, self).dispatch_request(repo, rev=rev, path=path)
402
397403 def make_template_context(self, *args):
398404 super(FileView, self).make_template_context(*args)
399405 if self.context['can_render']: