[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. I have read =
the Zope=20
Book, the Zope Web Application Construction book, and the online =
Developer's=20
Guide. The examples do not seem to help.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I want to organize my pages =
like:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>main folder/</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> subfolder 1/</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> =
sub-subfolder=20
1/</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> =
sub-subfolder=20
2/</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> subfolder =
2/</FONT></DIV><FONT=20
face=3DArial size=3D2>
<DIV><FONT face=3DArial size=3D2> =
sub-subfolder=20
3/</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> =
sub-subfolder=20
4/</FONT></DIV>
<DIV> subfolder 3/</DIV>
<DIV> </DIV>
<DIV>
<DIV>I want to put common methods and scripts 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> </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. Looks like the cookie is not =
visible by=20
the DTML document. How do I make the cookie visible?</DIV>
<DIV> </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. How do I do =
that? =20
Tried the following</DIV>
<DIV> </DIV>
<DIV>From sub-subfolder 3 I call</DIV>
<DIV> </DIV>
<DIV><dtml-if expr=3D"../sub-subfolder=20
4/function(parm)=3D'_['variable']'"></DIV>
<DIV>etc...</DIV>
<DIV> </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. Finds the documents in the hierarchy, but keeps adding to =
the URL=20
length. How do I avoid this and still reference documents in =
parallel=20
folders?</DIV>
<DIV> </DIV>
<DIV>Question Part 4:</DIV>
<DIV>I am not sure the best way to deal with error messages. 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. =
<RANT> 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. </RANT></DIV>
<DIV> </DIV>
<DIV>For example: I have a general validation script that I want =
to=20
control the error handling function. It calls several reusable =
scripts for=20
validating specific kinds of rules (like format, required fields, =
uniqueness,=20
etc...). How do I structure this so that I can reuse code, access =
it=20
properly, present the user with error messages.</DIV>
<DIV> </DIV>
<DIV>Thanks.</DIV>
<DIV> </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--