Hi,

as I already wrote I'm interested in being able to rewrite URLs before
the resource lookup starts. I thought about doing this as a tween. From
looking at the code I think it should be enough to change the path
attribute of the request (I'm also changing url and path_qs and
path_url). Now I realized that I can't overwrite the values of path (and
url, path_qs etc.). What would be the proper way to do this? Configure a
request factory overwriting these attributes? Or create a new request
within the tween cloning from the original request? How would you do
this in a clean way?

Any help or advice is very appreciated :)

Cheers,
Benjamin

On 01/25/2012 11:25 AM, benjamin.hepp wrote:
> Hi,
>
> I have a traversal based application with users and galleries etc. A
> typical URL would be
> /<username>/gallery/<category>
>
> Now I would also like to serve some content of a default user under
> /gallery/<category>
>
> I was wondering wether this is possible with combining traversal and
> URL dispatch but I think it is not. I also don't want to change my
> resource tree.
>
> So is there a possibility to achieve this without using a special URL
> dispatch route and redirecting with HTTPFound (I somehow feel that
> it's a waste of resources to just redirect all the time).
>
> If there is no good way to achieve this I thought about writing an
> extension to provide some "URL-rewrite" mechanism like this
>>> config.add_rewrite_rule('gallery/*rest', 
>>> '<default_username>/gallery/%(rest)s')
> or so.
>
> Cheers,
> Benjamin


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to