[ZCM] [ZC] 1845/ 8 Comment "ACTUAL_URL is not actual URL ;)"

Collector: Zope Bugs, Features, and Patches ... zope-coders-admin at zope.org
Mon Aug 8 06:45:59 EDT 2005


Issue #1845 Update (Comment) "ACTUAL_URL is not actual URL ;)"
 Status Pending, Zope/bug medium
To followup, visit:
  http://www.zope.org/Collectors/Zope/1845

==============================================================
= Comment - Entry #8 by yuppie on Aug 8, 2005 6:45 am

> = Comment - Entry #5 by limi on Jul 18, 2005 12:02 pm
> 
> 1) If you look at the original use case and reason for introducing
>   ACTUAL_URL, it was to use with anchors, which is why it needs the query
>   string

Well. That is *your* use case. VIRTUAL_URL was originally introduced for other use cases. And ACTUAL_URL is nothing special for anchors, it supersedes VIRTUAL_URL for all use cases.

> 2) The ACTUAL_URL code has existed for two point releases (introduced in
>   2.7.4 or 2.7.5), and I can't see how people can rely on it *not* having
>   the query string part. People expect it to, as several bug reports in the
>   Plone Collector has shown - which is why I'm here. ;)

Meanwhile more Zope versions with ACTUAL_URL are released. And people might have started working around this issue with code like the snippet in #3.

> Anyway, a notice in the changelog that it includes the query string
>   should be enough. I doubt anyone has gotten around to including this call
>   in their code yet - and if they have, they probably expect it to solve
>   the anchor use case, which it won't - yet.

I have code that will break if ACTUAL_URL is changed and I doubt I'm the only one.

-1 for changing the behavior of ACTUAL_URL (at least in a minor release)
________________________________________
= Comment - Entry #7 by limi on Aug 4, 2005 11:49 pm

I can confirm that the code snippet does the right thing, and gives the *actual* ACTUAL_URL :)
________________________________________
= Comment - Entry #6 by efge on Jul 18, 2005 12:25 pm

+1 for including the query string.

________________________________________
= Comment - Entry #5 by limi on Jul 18, 2005 12:02 pm

1) If you look at the original use case and reason for introducing ACTUAL_URL, it was to use with anchors, which is why it needs the query string

2) The ACTUAL_URL code has existed for two point releases (introduced in 2.7.4 or 2.7.5), and I can't see how people can rely on it *not* having the query string part. People expect it to, as several bug reports in the Plone Collector has shown - which is why I'm here. ;)

Anyway, a notice in the changelog that it includes the query string should be enough. I doubt anyone has gotten around to including this call in their code yet - and if they have, they probably expect it to solve the anchor use case, which it won't - yet.

Thanks for the code snippet, will test.

________________________________________
= Edit - Entry #4 by yuppie on Jul 18, 2005 11:13 am

 Changes: submitter email, edited transcript, new comment

fixed my last comment: should be ACTUAL_URL, not VIRTUAL_URL
________________________________________
= Comment - Entry #3 by yuppie on Jul 18, 2005 10:48 am

Before we add yet another variable, could you please test if this code has the desired behavior:

  <a tal:define="actual_query python:request['QUERY_STRING'] and '?'+request['QUERY_STRING'] or ''"
     tal:attributes="href string:${request/ACTUAL_URL}${actual_query}#someContent"
  > Skip to content</a>

'URL' variables in REQUEST never include the query string, so I'm not sure if it is a good idea to change ACTUAL_URL. Changing its behavior might also break existing code.
________________________________________
= Comment - Entry #2 by ajung on Jul 18, 2005 1:37 am

Patches are welcome :-)
________________________________________
= Request - Entry #1 by limi on Jul 17, 2005 11:45 pm

This is a follow-up to http://www.zope.org/Collectors/Zope/1568

The new ACTUAL_URL variable is 95% there, but doesn't include the query string of the URL, which it has to do to solve the use case for why ACTUAL_URL was invented in the first place: HTML anchors.

Please do not invent yet another variable for this, but add the query string to ACTUAL_URL. The other variations needed can be constructed from the existing elements, this is a convenience method for developers who need to render the URL currently shown in the URL bar.

(And if you *do* invent another variable, please make ACTUAL_URL include the query string and find another name for the one without the query string. ;)
==============================================================



More information about the Zope-Collector-Monitor mailing list