Acquisition and Error Handling Questions
Sorry for this trivial post - and let me know if this is the wrong list to post to, but I am struggling with acquisition (guess that makes me a newbie) and error handling in Zope. I have read the Zope Book, the Zope Web Application Construction book, and the online Developer's Guide. The examples do not seem to help. I want to organize my pages like: main folder/ subfolder 1/ sub-subfolder 1/ sub-subfolder 2/ subfolder 2/ sub-subfolder 3/ sub-subfolder 4/ subfolder 3/ I want to put common methods and scripts in one place (subfolder 1) and content in another (subfolder 2) and media resources like images in another (subfolder 3). Question Part 1: I want to set a cookie in a DTML method in sub-subfolder 3 and use it in a DTML document in sub-subfolder 4. Looks like the cookie is not visible by the DTML document. How do I make the cookie visible? Question Part 2: When trying to call Z SQL Methods or Python Scripts in a sub-subfolder 4 from sub-subfolder 3 I get syntax errors. How do I do that? Tried the following
From sub-subfolder 3 I call
<dtml-if expr="../sub-subfolder 4/function(parm)='_['variable']'"> etc... Question Part 3: I tried to split apart content in the reusable DTML documents, but in lower level folders Zope keeps appending folders to the URL and it keeps growing. Finds the documents in the hierarchy, but keeps adding to the URL length. How do I avoid this and still reference documents in parallel folders? Question Part 4: I am not sure the best way to deal with error messages. In scripts I can test conditions, but I am not sure how to pass the errors and messages back to the calling DTML method or document for presentation. <RANT> All of the books assume no errors and are vacuous on techniques like this that generally make up the bulk of a real application. </RANT> For example: I have a general validation script that I want to control the error handling function. It calls several reusable scripts for validating specific kinds of rules (like format, required fields, uniqueness, etc...). How do I structure this so that I can reuse code, access it properly, present the user with error messages. Thanks. ___________________ Tim Owen Cell: 517.285.7071 Home: 989.224.4905 eFax: 425.940.5905
On Tue, Dec 04, 2001 at 05:52:42AM -0500, Tim Owen wrote:
Question Part 1: I want to set a cookie in a DTML method in sub-subfolder 3 and use it in a DTML document in sub-subfolder 4. Looks like the cookie is not visible by the DTML document. How do I make the cookie visible?
Setting the path of the cookie.
Question Part 2: When trying to call Z SQL Methods or Python Scripts in a sub-subfolder 4 from sub-subfolder 3 I get syntax errors. How do I do that? Tried the following
From sub-subfolder 3 I call
<dtml-if expr="../sub-subfolder 4/function(parm)='_['variable']'"> ^^^^ Inside "" DTML expects a Python expression, not an URL.
Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
1. How do I set the cookie path? Do I use RESPONSE.setBase(BASEPATH1) prior to setting the cookie? I tried this and viewed the cookie in Netscape, but it did not seem to do the trick. 2. How do I call a Python script or Z SQL Method in a different folder at the same level in the folder tree? Thanks. ----- Original Message ----- From: "Oleg Broytmann" <phd@phd.pp.ru> To: "Tim Owen" <timowen@voyager.net> Cc: <zope@zope.org> Sent: Tuesday, December 04, 2001 7:03 AM Subject: Re: [Zope] Acquisition and Error Handling Questions
On Tue, Dec 04, 2001 at 05:52:42AM -0500, Tim Owen wrote:
Question Part 1: I want to set a cookie in a DTML method in sub-subfolder 3 and use it in a DTML document in sub-subfolder 4. Looks like the cookie is not visible by the DTML document. How do I make the cookie visible?
Setting the path of the cookie.
Question Part 2: When trying to call Z SQL Methods or Python Scripts in a sub-subfolder 4 from sub-subfolder 3 I get syntax errors. How do I do that? Tried the following
From sub-subfolder 3 I call
<dtml-if expr="../sub-subfolder 4/function(parm)='_['variable']'"> ^^^^ Inside "" DTML expects a Python expression, not an URL.
Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
On Wed, Dec 05, 2001 at 03:55:56AM -0500, Tim Owen wrote:
1. How do I set the cookie path?
RESPONSE.setCookie(name, value, path="XXX")
2. How do I call a Python script or Z SQL Method in a different folder at the same level in the folder tree?
<dtml-with otherFolder> <dtml-var someScript> </dtml-with otherFolder> Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
----- Original Message ----- From: Oleg Broytmann <phd@phd.pp.ru> To: Tim Owen <timowen@voyager.net> Cc: <zope@zope.org> Sent: Wednesday, December 05, 2001 10:11 AM Subject: Re: [Zope] Acquisition and Error Handling Questions
On Wed, Dec 05, 2001 at 03:55:56AM -0500, Tim Owen wrote:
1. How do I set the cookie path?
RESPONSE.setCookie(name, value, path="XXX")
BTW, this is in the zope API help, which is a pretty useful resource.
I wish I could whole-heartedly agree on its usefulness. I did check there first. There is no documentation on what **kw means in either the Zope Book or the API. In general, Zope documentation, while decent as a reference, is scattered everywhere and lacks meaningful examples. Not a knock, just an observation. It _is_ my intention to help resolve that by contributing to the documentation efforts once I get up to speed a bit more on proper techniques. Some of us are learning Zope, web development, and Python all at the same time. Anyway, I do appreciate your and Oleg's assistance on these questions and hopefully other lurkers are benefiting as well. I am progressing daily on the concepts with assistance like this when I run into the roadblocks. For what it's worth, several folks I know abandoned Zope in favor of PHP because of the documentation issues and concepts like acquisition being hard to grasp initially. Regards. ----- Original Message ----- From: "Seb Bacon" <seb@jamkit.com> To: "Tim Owen" <timowen@voyager.net> Cc: <zope@zope.org> Sent: Wednesday, December 05, 2001 6:00 AM Subject: Re: [Zope] Acquisition and Error Handling Questions
----- Original Message ----- From: Oleg Broytmann <phd@phd.pp.ru> To: Tim Owen <timowen@voyager.net> Cc: <zope@zope.org> Sent: Wednesday, December 05, 2001 10:11 AM Subject: Re: [Zope] Acquisition and Error Handling Questions
On Wed, Dec 05, 2001 at 03:55:56AM -0500, Tim Owen wrote:
1. How do I set the cookie path?
RESPONSE.setCookie(name, value, path="XXX")
BTW, this is in the zope API help, which is a pretty useful resource.
On Wed, Dec 05, 2001 at 11:00:10AM -0000, Seb Bacon wrote:
1. How do I set the cookie path?
RESPONSE.setCookie(name, value, path="XXX")
BTW, this is in the zope API help, which is a pretty useful resource.
But to understand it one needs to know what cookies are and how to manipulate and use them. Oleg. -- Oleg Broytmann http://www.zope.org/Members/phd/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
participants (3)
-
Oleg Broytmann -
Seb Bacon -
Tim Owen