[Zope] Acquisition and Error Handling Questions

Tim Owen timowen@voyager.net
Tue, 4 Dec 2001 05:52:42 -0500


This is a multi-part message in MIME format.

------=_NextPart_000_00C6_01C17C87.E3A44F70
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

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=3D"../sub-subfolder 4/function(parm)=3D'_['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.
  =20
___________________
Tim Owen
Cell: 517.285.7071
Home: 989.224.4905
eFax: 425.940.5905

------=_NextPart_000_00C6_01C17C87.E3A44F70
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 5.50.4616.200" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Sorry for this trivial post - and let =
me know if=20
this is the wrong list to post to, but I am struggling with acquisition =
(guess=20
that makes me a newbie) and error handling in Zope.&nbsp; I have read =
the Zope=20
Book, the Zope Web Application Construction book, and the online =
Developer's=20
Guide.&nbsp; The examples do not seem to help.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I want to organize my pages =
like:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>main folder/</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp; subfolder 1/</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
sub-subfolder=20
1/</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
sub-subfolder=20
2/</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp; subfolder =
2/</FONT></DIV><FONT=20
face=3DArial size=3D2>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
sub-subfolder=20
3/</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
sub-subfolder=20
4/</FONT></DIV>
<DIV>&nbsp;&nbsp; subfolder 3/</DIV>
<DIV>&nbsp;</DIV>
<DIV>
<DIV>I want to put common methods and scripts&nbsp;in one place =
(subfolder 1)=20
and content in another (subfolder 2) and media resources like images in =
another=20
(subfolder 3).</DIV></DIV>
<DIV>&nbsp;</DIV>
<DIV>Question Part 1:</DIV>
<DIV>I want to set a cookie in a DTML method in sub-subfolder 3 and use =
it in a=20
DTML document in sub-subfolder 4.&nbsp; Looks like the cookie is not =
visible by=20
the DTML document.&nbsp; How do I make the cookie visible?</DIV>
<DIV>&nbsp;</DIV>
<DIV>Question Part 2:</DIV>
<DIV>When trying to call Z SQL Methods or Python Scripts in a =
sub-subfolder 4=20
from sub-subfolder 3 I get syntax errors.&nbsp; How do I do =
that?&nbsp;&nbsp;=20
Tried the following</DIV>
<DIV>&nbsp;</DIV>
<DIV>From sub-subfolder 3 I call</DIV>
<DIV>&nbsp;</DIV>
<DIV>&lt;dtml-if expr=3D"../sub-subfolder=20
4/function(parm)=3D'_['variable']'"&gt;</DIV>
<DIV>etc...</DIV>
<DIV>&nbsp;</DIV>
<DIV>Question Part 3:</DIV>
<DIV>I tried to split apart content in the reusable DTML documents, but =
in lower=20
level folders Zope keeps appending folders to the URL and it keeps=20
growing.&nbsp; Finds the documents in the hierarchy, but keeps adding to =
the URL=20
length.&nbsp; How do I avoid this and still reference documents in =
parallel=20
folders?</DIV>
<DIV>&nbsp;</DIV>
<DIV>Question Part 4:</DIV>
<DIV>I am not sure the best way to deal with error messages.&nbsp; In =
scripts I=20
can test conditions, but I am not sure how to pass the errors and =
messages back=20
to the calling DTML method or document for presentation.&nbsp; =
&lt;RANT&gt; All=20
of the books assume no errors and are vacuous on techniques like this =
that=20
generally make up the bulk of a real application. &lt;/RANT&gt;</DIV>
<DIV>&nbsp;</DIV>
<DIV>For example:&nbsp; I have a general validation script that I want =
to=20
control the error handling function.&nbsp; It calls several reusable =
scripts for=20
validating specific kinds of rules (like format, required fields, =
uniqueness,=20
etc...).&nbsp; How do I structure this so that I can reuse code, access =
it=20
properly, present the user with error messages.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Thanks.</DIV>
<DIV>&nbsp;&nbsp; </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>___________________<BR>Tim =
Owen<BR>Cell:=20
517.285.7071<BR>Home: 989.224.4905<BR>eFax:=20
425.940.5905</FONT></DIV></BODY></HTML>

------=_NextPart_000_00C6_01C17C87.E3A44F70--