Merge lp:~mwhudson/loggerhead/bug-383631 into lp:loggerhead

Proposed by Michael Hudson-Doyle
Status: Merged
Approved by: John A Meinel
Approved revision: 463
Merged at revision: 462
Proposed branch: lp:~mwhudson/loggerhead/bug-383631
Merge into: lp:loggerhead
Diff against target: 45 lines (+5/-5)
2 files modified
loggerhead/templates/breadcrumbs.pt (+1/-1)
loggerhead/util.py (+4/-4)
To merge this branch: bzr merge lp:~mwhudson/loggerhead/bug-383631
Reviewer Review Type Date Requested Status
John A Meinel Needs Information
Review via email: mp+87877@code.launchpad.net

Description of the change

This branch fixes the linked bug, twice over:

1) It changes the URLs of the in-branch breadcrumbs to be based on paths, like everything else in Loggerhead has been for years.

2) It removes 'file_id' from the set of query arguments that the (disgusting, I'd forgotten how horrible this bit was) machinery used by context_url preserves, now that we never ever generate a url with a file_id argument.

Cheers,
mwh

To post a comment you must log in.
Revision history for this message
John A Meinel (jameinel) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 1/8/2012 10:54 PM, Michael Hudson-Doyle wrote:
> Michael Hudson-Doyle has proposed merging
> lp:~mwhudson/loggerhead/bug-383631 into lp:loggerhead.
>
> Requested reviews: Loggerhead Reviewers (loggerhead-reviewers)
> Related bugs: Bug #383631 in loggerhead: "Breadcrumbs while
> annotating a file in head shows the most recent revision in the url
> instead of head" https://bugs.launchpad.net/loggerhead/+bug/383631
>
> For more details, see:
> https://code.launchpad.net/~mwhudson/loggerhead/bug-383631/+merge/87877
>
> This branch fixes the linked bug, twice over:
>
> 1) It changes the URLs of the in-branch breadcrumbs to be based on
> paths, like everything else in Loggerhead has been for years.
>
> 2) It removes 'file_id' from the set of query arguments that the
> (disgusting, I'd forgotten how horrible this bit was) machinery
> used by context_url preserves, now that we never ever generate a
> url with a file_id argument.
>
> Cheers, mwh

I love getting rid of file_id in the URLs, but will this break
existing URLs if people are saving them somewhere? ISTR some people
wanted a good way to point people at :head of a file like README, etc.

I especially like this:
- - 'file_id': inv.path2id('/'.join(dir_parts[:index + 1])),
+ 'path': '/'.join(dir_parts[:index + 1]),

Internally it was already doing paths, and forcing a translation to
file_id at this part.

Anyway, if it is incompatible, is there a way we could try to migrate
gracefully?

 review: needsinfo

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk8W3/UACgkQJdeBCYSNAAOPCQCfX+WJIFLOagJvmKJnLy+/tKXJ
snsAn0jlmnE6b3DHidXeMLPZLnOIUaP0
=UHk1
-----END PGP SIGNATURE-----

review: Needs Information
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

On Wed, 18 Jan 2012 16:06:29 +0100, John Arbash Meinel <email address hidden> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 1/8/2012 10:54 PM, Michael Hudson-Doyle wrote:
> > Michael Hudson-Doyle has proposed merging
> > lp:~mwhudson/loggerhead/bug-383631 into lp:loggerhead.
> >
> > Requested reviews: Loggerhead Reviewers (loggerhead-reviewers)
> > Related bugs: Bug #383631 in loggerhead: "Breadcrumbs while
> > annotating a file in head shows the most recent revision in the url
> > instead of head" https://bugs.launchpad.net/loggerhead/+bug/383631
> >
> > For more details, see:
> > https://code.launchpad.net/~mwhudson/loggerhead/bug-383631/+merge/87877
> >
> > This branch fixes the linked bug, twice over:
> >
> > 1) It changes the URLs of the in-branch breadcrumbs to be based on
> > paths, like everything else in Loggerhead has been for years.
> >
> > 2) It removes 'file_id' from the set of query arguments that the
> > (disgusting, I'd forgotten how horrible this bit was) machinery
> > used by context_url preserves, now that we never ever generate a
> > url with a file_id argument.
> >
> > Cheers, mwh
>
> I love getting rid of file_id in the URLs, but will this break
> existing URLs if people are saving them somewhere? ISTR some people
> wanted a good way to point people at :head of a file like README, etc.

This branch doesn't change how any URLs are processed, it just changes
the ones which are generated on the page. It will change where the
links on pages accessed via ?file_id=xxx go to, but from ones that are
broken to ones that work, so I think that's probably a good thing :-)

Cheers,
mwh

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'loggerhead/templates/breadcrumbs.pt'
--- loggerhead/templates/breadcrumbs.pt 2008-09-30 02:04:14 +0000
+++ loggerhead/templates/breadcrumbs.pt 2012-01-08 21:53:23 +0000
@@ -10,7 +10,7 @@
1010
11<!-- Branch breadcrumbs (for the path within the branch) -->11<!-- Branch breadcrumbs (for the path within the branch) -->
12<span metal:define-macro="branch" class="breadcrumb">12<span metal:define-macro="branch" class="breadcrumb">
13 <tal:block repeat="crumb branch_breadcrumbs">/<a tal:attributes="href python:url([crumb['suffix'], change.revno], file_id=crumb['file_id'])" tal:content="crumb/dir_name" tal:condition="not:repeat/crumb/end" /><span tal:replace="crumb/dir_name" tal:condition="repeat/crumb/end" /></tal:block>13 <tal:block repeat="crumb branch_breadcrumbs">/<a tal:attributes="href python:url([crumb['suffix'], change.revno, crumb['path']])" tal:content="crumb/dir_name" tal:condition="not:repeat/crumb/end" /><span tal:replace="crumb/dir_name" tal:condition="repeat/crumb/end" /></tal:block>
14</span>14</span>
1515
16<!-- Directory breadcrumbs (for the path leading up to the branch) -->16<!-- Directory breadcrumbs (for the path leading up to the branch) -->
1717
=== modified file 'loggerhead/util.py'
--- loggerhead/util.py 2011-09-08 00:33:28 +0000
+++ loggerhead/util.py 2012-01-08 21:53:23 +0000
@@ -226,7 +226,7 @@
226def html_escape(s):226def html_escape(s):
227 """Transform dangerous (X)HTML characters into entities.227 """Transform dangerous (X)HTML characters into entities.
228228
229 Like cgi.escape, except also escaping " and '. This makes it safe to use229 Like cgi.escape, except also escaping \" and '. This makes it safe to use
230 in both attribute and element content.230 in both attribute and element content.
231231
232 If you want to safely fill a format string with escaped values, use232 If you want to safely fill a format string with escaped values, use
@@ -484,7 +484,7 @@
484 for index, dir_name in enumerate(dir_parts):484 for index, dir_name in enumerate(dir_parts):
485 inner_breadcrumbs.append({485 inner_breadcrumbs.append({
486 'dir_name': dir_name,486 'dir_name': dir_name,
487 'file_id': inv.path2id('/'.join(dir_parts[:index + 1])),487 'path': '/'.join(dir_parts[:index + 1]),
488 'suffix': '/' + view,488 'suffix': '/' + view,
489 })489 })
490 return inner_breadcrumbs490 return inner_breadcrumbs
@@ -555,8 +555,8 @@
555# for re-ordering an existing page by different sort555# for re-ordering an existing page by different sort
556556
557t_context = threading.local()557t_context = threading.local()
558_valid = ('start_revid', 'file_id', 'filter_file_id', 'q', 'remember',558_valid = (
559 'compare_revid', 'sort')559 'start_revid', 'filter_file_id', 'q', 'remember', 'compare_revid', 'sort')
560560
561561
562def set_context(map):562def set_context(map):

Subscribers

People subscribed via source and target branches