~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to loggerhead/controllers/view_ui.py

  • Committer: John Arbash Meinel
  • Date: 2011-03-15 10:24:40 UTC
  • mfrom: (432.1.3 loggerhead)
  • Revision ID: john@arbash-meinel.com-20110315102440-n4zr988738z125cd
Merge fix for bug #569358. Redirect requests so people can URL hack.

If you edit /files/directory to become /files/directory/filename, redirect it to
the /view/directory/filename, and conversly if you go to /view/directory redirect
it to /files/directory. This way people can edit the URL in a logical way
and still get the view they are expecting.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
import bzrlib.textfile
26
26
import bzrlib.osutils
27
27
 
28
 
from paste.httpexceptions import HTTPBadRequest, HTTPServerError
 
28
from paste.httpexceptions import HTTPBadRequest, HTTPServerError, HTTPMovedPermanently
29
29
 
30
30
from loggerhead.controllers import TemplatedBranchView
31
31
try:
120
120
            raise HTTPServerError('Could not fetch changes')
121
121
        branch_breadcrumbs = util.branch_breadcrumbs(path, inv, 'files')
122
122
 
 
123
        if inv[file_id].kind == "directory":
 
124
            raise HTTPMovedPermanently(self._branch.context_url(['/files', revno_url, path]))
 
125
 
123
126
        return {
124
127
            # In AnnotateUI, "annotated" is a generator giving revision
125
128
            # numbers per lines, but the template checks if "annotated" is