[Zope] tutorial

Milos Prudek milos.prudek@tiscali.cz
Mon, 13 May 2002 10:10:55 +0200


Sebastiaan Schimmel wrote:
> I've done the Elvis tutorial. I want to set a cookie and I do it like
> it's done in the elvis tutorial but it doesn't work. The elvis tutorial


Here's a sample Python Script to set a cookie:

request = container.REQUEST
RESPONSE =  request.RESPONSE
tag=repr(DateTime().timeTime())
RESPONSE.setCookie('zopeimp',tag,path='/')
return

You do not need a function to read a cookie. Cookies are in the request.

I recommend that you add this line to your standard_html_footer:

<dtml-var REQUEST>

You'll see everything that's in the request. Great for debugging!

Admittedly, Zope Book is still somewhat incomplete and the example you 
tested may be wrong. I did not test the Elvis example but I'll try to 
give you general advice: Do not rely too much on Zope Book as "the 
complete, perfect source of documentation". The best resources that 
complement Zope Book are:

- Archives of this mailing list
- http://zopelabs.com
- your own testing (try-fail-try-fail-try-success method)

Write your own small test scripts. Record the results of these test 
scripts in a good knowledge management system (I use Hierarchical 
Notebook, available from SourceForge for both Linux and Windows). Build 
your own know-how.

-- 
Milos Prudek