Re: [Zope] question on URL styling

2006-09-11 Thread Erik Myllymaki



David H wrote:

Erik Myllymaki wrote:




David H wrote:


Jonathan wrote:



- Original Message - From: "Erik Myllymaki" 
<[EMAIL PROTECTED]>

To: 
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 (), 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'm not too sure I understand the pollution reference...do you mean 
that it would make sense that an end user would only ever bookmark to 
the start of the survey, and not half way through?


I guess it's more for me and the designers then for end users.

After the user goes through the 30+ pages of survey questions, they are
presented with a summary page which basically shows all the 'Q's and 
'A's and their contact info on one big page "Hi, JOE from CALGARY, you 
told us that your favourite colour is GREEN, your favourite fruit is a 
BANANA ... etc.".


There are links beside each answer so that they can go back and change 
that answer before submitting the survey if they wish. So, they should 
have access to each and every page by name and they can jump around 
within the survey.





If you have users that will fill out 30+ pages of any survey I want your 
mailing list. :-)


we'll call them a "captive audience" :)


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] question on URL styling

2006-09-11 Thread David H

Erik Myllymaki wrote:




David H wrote:


Jonathan wrote:



- Original Message - From: "Erik Myllymaki" 
<[EMAIL PROTECTED]>

To: 
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 (), 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'm not too sure I understand the pollution reference...do you mean 
that it would make sense that an end user would only ever bookmark to 
the start of the survey, and not half way through?


I guess it's more for me and the designers then for end users.

After the user goes through the 30+ pages of survey questions, they are
presented with a summary page which basically shows all the 'Q's and 
'A's and their contact info on one big page "Hi, JOE from CALGARY, you 
told us that your favourite colour is GREEN, your favourite fruit is a 
BANANA ... etc.".


There are links beside each answer so that they can go back and change 
that answer before submitting the survey if they wish. So, they should 
have access to each and every page by name and they can jump around 
within the survey.





If you have users that will fill out 30+ pages of any survey I want your 
mailing list. :-)


Also, you might try a page legend?  I use stuff like that for large 
charts of accounts (no one wants to click  click click to get to even 
the middle of a page list)


I hope your project does well!

All best erik,
David


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] question on URL styling

2006-09-11 Thread Erik Myllymaki



David H wrote:

Jonathan wrote:



- Original Message - From: "Erik Myllymaki" 
<[EMAIL PROTECTED]>

To: 
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 (), 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'm not too sure I understand the pollution reference...do you mean that it 
would make sense that an end user would only ever bookmark to the start of the 
survey, and not half way through?


I guess it's more for me and the designers then for end users.

After the user goes through the 30+ pages of survey questions, they are
presented with a summary page which basically shows all the 'Q's and 'A's and 
their contact info on one big page "Hi, JOE from CALGARY, you told us that your 
favourite colour is GREEN, your favourite fruit is a BANANA ... etc.".


There are links beside each answer so that they can go back and change that 
answer before submitting the survey if they wish. So, they should have access 
to each and every page by name and they can jump around within the survey.




___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] question on URL styling

2006-09-11 Thread David H

Jonathan wrote:



- Original Message - From: "Erik Myllymaki" 
<[EMAIL PROTECTED]>

To: 
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 (), 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



___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] question on URL styling

2006-09-11 Thread Erik Myllymaki



Andreas Jung wrote:



--On 11. September 2006 09:33:39 -0700 Erik Myllymaki 
<[EMAIL PROTECTED]> wrote:




I'm trying this out and it seems to be working:

request.RESPONSE.redirect(context[next_page].absolute_url())

is this the *correct* way to do it?


Basically yes. But it is bad practice to perform redirections with a ZPT
(I assume that since you're using lowercase 'request'). Better use a
PythonScript instead.



yes it is in a python script; i just keep the boilerplate from the example 
python scripts around:


request = context.REQUEST
.
.
.
request.RESPONSE.redirect(context[next_page].absolute_url())
.
.
.


Thanks.
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] question on URL styling

2006-09-11 Thread Andreas Jung



--On 11. September 2006 09:33:39 -0700 Erik Myllymaki 
<[EMAIL PROTECTED]> wrote:




I'm trying this out and it seems to be working:

request.RESPONSE.redirect(context[next_page].absolute_url())

is this the *correct* way to do it?


Basically yes. But it is bad practice to perform redirections with a ZPT
(I assume that since you're using lowercase 'request'). Better use a
PythonScript instead.

-aj

pgpNF6PQVTMGP.pgp
Description: PGP signature
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] question on URL styling

2006-09-11 Thread Erik Myllymaki


I'm trying this out and it seems to be working:

request.RESPONSE.redirect(context[next_page].absolute_url())

is this the *correct* way to do it?



Erik Myllymaki wrote:

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 (), 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.


Thanks for any suggestions.




___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] question on URL styling

2006-09-11 Thread Jonathan


- Original Message - 
From: "Erik Myllymaki" <[EMAIL PROTECTED]>

To: 
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 
(), 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 



___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] question on URL styling

2006-09-11 Thread Erik Myllymaki

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 (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.


Thanks for any suggestions.




___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )