Changeset - a83e86e3f580
[Not reviewed]
default
0 1 0
Marcin Kuzminski - 15 years ago 2010-06-08 23:02:24
marcin@python-works.com
fixed bug when displaying html not escaped data as raw diff.
1 file changed with 2 insertions and 1 deletions:
0 comments (0 inline, 0 general)
pylons_app/controllers/files.py
Show inline comments
 
@@ -17,24 +17,25 @@
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
# MA  02110-1301, USA.
 
"""
 
Created on April 21, 2010
 
files controller for pylons
 
@author: marcink
 
"""
 
from mercurial import archival
 
from pylons import request, response, session, tmpl_context as c, url
 
from pylons_app.lib.auth import LoginRequired
 
from pylons_app.lib.base import BaseController, render
 
import pylons_app.lib.helpers as h 
 
from pylons_app.model.hg_model import HgModel
 
from vcs.exceptions import RepositoryError, ChangesetError
 
from vcs.utils import diffs as differ
 
import logging
 
import tempfile
 

	
 
        
 
log = logging.getLogger(__name__)
 

	
 
class FilesController(BaseController):
 
    
 
    @LoginRequired()
 
@@ -148,25 +149,25 @@ class FilesController(BaseController):
 
                            c.changeset_2.get_node(f_path))
 
        
 
        diff = differ.DiffProcessor(f_udiff)
 
                                
 
        if action == 'download':
 
            diff_name = '%s_vs_%s.diff' % (diff1, diff2)
 
            response.content_type = 'text/plain'
 
            response.content_disposition = 'attachment; filename=%s' \
 
                                                    % diff_name             
 
            return diff.raw_diff()
 
        
 
        elif action == 'raw':
 
            c.cur_diff = '<pre class="raw">%s</pre>' % diff.raw_diff()
 
            c.cur_diff = '<pre class="raw">%s</pre>' % h.escape(diff.raw_diff())
 
        elif action == 'diff':
 
            c.cur_diff = diff.as_html()
 

	
 
        return render('files/file_diff.html')
 
    
 
    def _get_history(self, repo, node, f_path):
 
        from vcs.nodes import NodeKind
 
        if not node.kind is NodeKind.FILE:
 
            return []
 
        changesets = node.history
 
        hist_l = []
 
        for chs in changesets:
0 comments (0 inline, 0 general)