Link destinations in page templates get prepended with a slash

Bug #101349 reported by Kit Blake
4
Affects Status Importance Assigned to Milestone
Silva
Fix Released
High
Kit Blake

Bug Description

In the Silva interface, there are some standard access keys that appear in every
screen, such as alt-t (top of page) and alt-b (bottom). These keys are defined
in the macro_index page template:

  <a accesskey="t"
    href="#top"
    title="jump to top: alt-t">....

Using this issue page as an example, when the above gets rendered in the
browser, you would expect the link to be:

  http://issues.infrae.com/silva/issue1233#top

But somehow a slash gets prepended, resulting in this:

  http://issues.infrae.com/silva/issue1233/#top

which works (because everything's an object) but it causes a reload. You can get
around this by tal:attributing the href, using absolute_url. But that's
expensive. Anybody know where that slash is coming from?

[1234]

Revision history for this message
Clemens Robbenhaar (crobbenhaar) wrote :

as far as I know the slash comes from Zope inserting a base tag,
if the is none in the template. The default base tag is the path
of the "current request", followed by a slash if it does not end in a slash aleady
(see ZPublisher.setBase somewhere ...)

The workaround is to add an own <base> tag to the macro_index.
I remeber vaguely I did something in the install-instructions for my
SilvaLocalContent (for some completely different reason ...)

Revision history for this message
Kit Blake (kitblake) wrote :

Thank you Clemens, I'll experiment with this.

Changed in silva:
assignee: nobody → aaltepet
Revision history for this message
Andy Altepeter (aaltepet) wrote :

Kit, you added a <base> tag to macro_index, "to handle Five methods with ..". But, this "really" messes up these access keys, as now the base is "model.absolute_url() + /edit/", so all of these will link back to the edit tab, even if they're on a different tab.

So, I'm completely sure yet how this should be handled. I think it is reasonable to say that the last part of the URL will always be just after "/edit/", since all of the SMI areas I've noticed are directly underneath "/edit/". So, is it reasonable to say "add the last url part to the base tag as a non-container" (i.e. don't add a trailing /)? I'm not as familiar with the Five views, so I can't say whether there is more than one url part after /edit/ for those.

Changed in silva:
assignee: aaltepet → kitblake
Revision history for this message
Kit Blake (kitblake) wrote :

Good point. Those access keys are also in macro_index, and there's only a few of them. Maybe we should make it link to the 'whole' url including 'tab_*#anchorname' ? Part of the thinking is that the tab_* part of the url is not physical (in the content hierarchy) but in application space (signalled by /edit/).

This is difficult problem that seemed unsolvable (until we switch to Five views completely).

Kit Blake (kitblake)
Changed in silva:
importance: Medium → High
Revision history for this message
Kit Blake (kitblake) wrote :

These links to anchors have been fixed (rev 27300). Backported to 2.05.

Changed in silva:
milestone: none → 2.0.5
status: Confirmed → Fix Committed
Changed in silva:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.