~loggerhead-team/loggerhead/experimental

« back to all changes in this revision

Viewing changes to loggerhead/controllers/view_ui.py

  • Committer: John Arbash Meinel
  • Date: 2011-04-11 14:55:55 UTC
  • mfrom: (419.2.26 loggerhead)
  • Revision ID: john@arbash-meinel.com-20110411145555-7xflzcipb32kuknh
Merge trunk into the history-db branch.

We had to disable the mainline tests, because they were monkey-patching
a parameter that we have removed. We need to figure out a way to
do a similar test.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
18
#
19
19
 
20
 
import cgi
21
20
import time
22
21
 
23
22
import bzrlib.errors
24
23
import bzrlib.textfile
25
24
import bzrlib.osutils
26
25
 
27
 
from paste.httpexceptions import HTTPBadRequest, HTTPServerError
 
26
from paste.httpexceptions import HTTPBadRequest, HTTPServerError, HTTPMovedPermanently
28
27
 
29
28
from loggerhead.controllers import TemplatedBranchView
30
29
try:
61
60
            extra_lines = len(file_lines) - len(hl_lines)
62
61
            hl_lines.extend([u''] * extra_lines)
63
62
        else:
64
 
            hl_lines = map(cgi.escape, file_lines)
 
63
            hl_lines = map(util.html_escape, file_lines)
65
64
        
66
65
        return hl_lines;
67
66
 
76
75
 
77
76
    def get_values(self, path, kwargs, headers):
78
77
        file_info = self.file_info(path, kwargs)
 
78
        file_id = file_info['file_id']
79
79
        path = file_info['path']
80
80
        revid = file_info['revid']
81
81
 
106
106
            raise HTTPServerError('Could not fetch changes')
107
107
        branch_breadcrumbs = util.branch_breadcrumbs(path, inv, 'files')
108
108
 
 
109
        if inv[file_id].kind == "directory":
 
110
            raise HTTPMovedPermanently(self._branch.context_url(['/files', revno_url, path]))
 
111
 
109
112
        return {
110
113
            # In AnnotateUI, "annotated" is a generator giving revision
111
114
            # numbers per lines, but the template checks if "annotated" is