[Zope-dev] Python method wrapping around DTML method

Bjorn Stabell bjorn@exoweb.net
Fri, 3 Jan 2003 18:13:24 +0800


This is a multi-part message in MIME format.

------_=_NextPart_001_01C2B310.C0003CDD
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Hi,
=20
This has been buggering me for ages, and I've spent too many hours
trying to figure it out already, so I'm resorting to the list for help.
:)
=20
I have two functions, PlainFunc and DTMLFunc, where PlainFunc is Python
method in a file system product, and DTMLFunc is a DTML Method in the
ZODB.
=20
What I want to do is this:
=20
    ZPublisher calls PlainFunc (publishes it)
    PlainFunc calls DTMLFunc
=20
in such a way that DTMLFunc gets everything it needs, e.g., namespace,
but PlainFunc can do funky things to this namespace before-hand (like
insert a few variables into it).  In other words, I want a Python method
to wrap around a DTML method.
=20
I've encountered many problems caused by the awkward calling conventions
for DTML methods and the automagic switching between different calling
conventions by the ZPublisher (isDocTemp; can I set that for a normal
Python method?).  Right now, I'm struggeling because I cannot get the
namespace to be passed to PlainFunc, therefore PlainFunc cannot pass the
namespace on to DTMLFunc.  Any clues?
=20
Bye,
--=20
Bjorn Stabell  <mailto:bjorn@exoweb.net> bjorn@exoweb.net
Tel +86 (10) 65918490
=20

------_=_NextPart_001_01C2B310.C0003CDD
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<TITLE>Message</TITLE>

<META content=3D"MSHTML 6.00.2800.1126" name=3DGENERATOR></HEAD>
<BODY>
<DIV><SPAN class=3D099440310-03012003><FONT face=3D"Palatino Linotype"=20
size=3D2>Hi,</FONT></SPAN></DIV>
<DIV><FONT face=3D"Palatino Linotype"><FONT size=3D2><SPAN=20
class=3D099440310-03012003><FONT face=3D"Palatino Linotype"=20
size=3D2></FONT></SPAN></FONT></FONT>&nbsp;</DIV>
<DIV><SPAN class=3D099440310-03012003><FONT face=3D"Palatino Linotype" =
size=3D2>This=20
has been buggering me for ages, and I've spent too many hours trying to =
figure=20
it out already, so I'm resorting to the list for help. =
:)</FONT></SPAN></DIV>
<DIV><FONT face=3D"Palatino Linotype"><FONT size=3D2><SPAN=20
class=3D099440310-03012003><FONT face=3D"Palatino Linotype"=20
size=3D2></FONT></SPAN></FONT></FONT>&nbsp;</DIV>
<DIV><SPAN class=3D099440310-03012003><FONT face=3D"Palatino Linotype" =
size=3D2>I have=20
two functions, PlainFunc and DTMLFunc, where PlainFunc is Python method =
in a=20
file system product, and DTMLFunc is a DTML Method&nbsp;in the=20
ZODB.</FONT></SPAN></DIV>
<DIV><FONT face=3D"Palatino Linotype"><FONT size=3D2><SPAN=20
class=3D099440310-03012003><FONT face=3D"Palatino Linotype"=20
size=3D2></FONT></SPAN></FONT></FONT>&nbsp;</DIV>
<DIV><SPAN class=3D099440310-03012003><FONT face=3D"Palatino Linotype" =
size=3D2>What I=20
want to do is this:</FONT></SPAN></DIV>
<DIV><SPAN class=3D099440310-03012003><FONT face=3D"Palatino Linotype"=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D099440310-03012003>&nbsp;&nbsp;&nbsp; <FONT=20
face=3D"Palatino Linotype" size=3D2>ZPublisher calls PlainFunc =
(publishes=20
it)</FONT></SPAN></DIV>
<DIV><SPAN class=3D099440310-03012003>&nbsp;&nbsp;&nbsp; <FONT=20
face=3D"Palatino Linotype" size=3D2>PlainFunc calls =
DTMLFunc</FONT></SPAN></DIV>
<DIV><SPAN class=3D099440310-03012003><FONT face=3D"Palatino Linotype"=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D099440310-03012003><FONT face=3D"Palatino Linotype" =
size=3D2>in=20
such a way that DTMLFunc gets everything it needs, e.g., namespace, but=20
PlainFunc can do funky things to this namespace before-hand (like insert =
a few=20
variables into it).&nbsp; In other words, I want a Python method to wrap =
around=20
a DTML method.</FONT></SPAN></DIV>
<DIV><SPAN class=3D099440310-03012003><FONT face=3D"Palatino Linotype"=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D099440310-03012003><FONT face=3D"Palatino Linotype" =
size=3D2>I've=20
encountered many problems caused by the awkward calling conventions for =
DTML=20
methods and the automagic switching between different calling =
conventions by the=20
ZPublisher (isDocTemp; can I set that for a normal Python =
method?).&nbsp; Right=20
now, I'm struggeling because I cannot get the namespace to be passed to=20
PlainFunc, therefore PlainFunc cannot pass the namespace on to =
DTMLFunc.&nbsp;=20
Any clues?</FONT></SPAN></DIV>
<DIV><FONT face=3D"Palatino Linotype" size=3D2></FONT>&nbsp;</DIV>
<DIV class=3DMsoAutoSig align=3Dleft><FONT face=3D"Palatino Linotype"=20
size=3D2>Bye,<BR>-- <BR>Bjorn Stabell </FONT><A=20
href=3D"mailto:bjorn@exoweb.net"><FONT face=3D"Palatino Linotype"=20
size=3D2>bjorn@exoweb.net</FONT></A><BR><FONT face=3D"Palatino Linotype" =
size=3D2>Tel=20
+86 (10) 65918490</FONT></DIV>
<DIV>&nbsp;</DIV></BODY></HTML>

------_=_NextPart_001_01C2B310.C0003CDD--