[Zope] question on URL styling

David H bluepaul at earthlink.net
Mon Sep 11 12:50:29 EDT 2006


Jonathan wrote:

>
> ----- Original Message ----- From: "Erik Myllymaki" 
> <erik.myllymaki at aviawest.com>
> To: <zope at zope.org>
> Sent: Monday, September 11, 2006 12:24 PM
> Subject: [Zope] question on URL styling
>
>
>> I am making a survey that has many very similar pages all in one 
>> directory.
>> The page templates are called page-1.html, page-2.html, ... page-n.html.
>>
>> I am using two submit buttons on each of the pages; one for 'Next' 
>> and one for 'Previous' so that I catch changes to the form elements 
>> in each direction. I use a python script as index_html, and hit it on 
>> each submit (<form action=".">), and then redirect to the appropriate 
>> page, whether that page is current_page++ or current_page--. I also 
>> stuff all form variables into SESSION in the index_html python script.
>>
>> What I am wondering though, is how to display the 'page' portion of 
>> the address - right now it always just displays as 
>> http://myzopesite.com/workingdirectory/
>>
>> I would like it to display 
>> http://myzopesite.com/workingdirectory/page-1.html, 
>> http://myzopesite.com/workingdirectory/page-1.html, etc.
>>
>> The pages are all accessible directly by those names, but by always 
>> going to index_html and returning the page via "return 
>> container[next_page](context, request)" I never see this part in the 
>> URL.
>
>
> One possible work-around is to rename your python script, reformat 
> your urls and use traverse_subpath to access the page to be 
> displayed.  eg.  if you name your script 'displayPage', then you can 
> have a url like:
>
> http://myzopesite/workingdirectory/displayPage/page-1.html
>
> the displayPage script will be invoked and it can then access 
> REQUEST['traverse_subpath'] (which in the above case will contain 
> 'page-1.html').
>
>
> hth
>
> Jonathan
>
Erik,
I find your "use case" a bit strange.  Why would your users need to see 
different URLs?  Doesnt that pollute their browser's history list - and 
do you want them clicking some Page-nn from history? 

I like the idea of using a python script as index_html and using it as a 
router.  Instead of a redirect I use

return someZpt(context, request)

David





More information about the Zope mailing list