[Grok-dev] Traverser, Request and URL mess
Jan-Wijbrand Kolman
janwijbrand at gmail.com
Wed Oct 14 06:26:28 EDT 2009
Martijn Faassen wrote:
snip
> If the problem indeed is about the ability to generate URLs to other
> skins, this is a long-standing discussion with no conclusion. The story
> appears to me that:
>
> * we keep running into it
>
> * it appears hard to devise a general solution
>
> Since we keep runnign into it, perhaps we can come up with a more
> limited solution, where it's at least possible to create URLs *without*
> any ++skin++ bit in it, or to at least add ++skin++foo easily to an
> existing URL (somewhere in the beginning). That won't cover all cases
> (virtual hosts, namespaces not appearing at the root of the URL, other
> things?) but it would cover a lot of them. We also need to make sure we
> can handle your case, where instead of ++skin++foo, you just want ++foo++.
Right, this is something I run into as well every now and then.
> Perhaps we need an API like this:
>
> self.url(..., namespace=('skin', 'foo')
>
> to go to ++skin++foo
>
> and:
>
> self.url(..., namespace=('grokui',None)
>
> to go to ++grokui++
>
> and:
>
> self.url(..., namespace=(None, None))
>
> to have no special namespace.
>
> the default would have namespace be None and it'd always generate URLs
> within the same namespace then. This is what it does already.
>
> I think it would probably simplest to make this work by simple but
> well-tested string rewriting.
The problem is tough: there's really not an easy __generic__ solution
for this problem for the reasons you describe. As such, I think I like
your idea: to at least formalize the string rewriting.
Maybe the skin name in ``namespace=('skin', 'MySkinName')`` could even
be, optionally, derived from the skin component itself!
+1 for such an addition to the ``self.url()`` method.
regards,
jw
More information about the Grok-dev
mailing list