[Zope-dev] Tag DTML

Aitor Grajal Crespo Aitor.Grajal@inetsysonline.com
Thu, 02 Nov 2000 18:17:52 +0100


--=====_97318547241=_
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable

Hello, I have coded my own DTML tag and i want to catch a property of the=
 folder where the DTML-Coded is. 

How can i do this??? 


from DocumentTemplate.DT_Util import * # useful parsing methods you'll need=
 
from DocumentTemplate.DT_String import String # explained later 

class FuenteTag:

    name =3D 'fuente'    blockContinuations=3D()
    expand=3DNone

    def __init__(self, blocks):
        tname, args, section =3D blocks[0]
        self.tname=3Dtname
        self.section=3Dsection
        args=3Dparse_params(args, font=3D'Verdana', size=3D'2')
        self.args=3Dargs
        self.font =3D args.get('font','Verdana')
        self.size =3D args.get('size','2')

    def render(self, md):
        cadena =3D '<FONT FACE=3D"'+self.font+'" SIZE=3D"' + self.size +=
 '">' +self.section(md)+'</FONT>'
                 
        return cadena


    __call__ =3D render

String.commands['fuente'] =3D FuenteTag 
/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
 
Aitor Grajal Crespo
Director General
e-mail: Aitor.Grajal@inetsysonline.com

INETSYS, S.L.
ETSI Inform=E1tica
Ctra. Colmenar, km. 15,500
28049 MADRID
SPAIN
Tfno : (34) 91 348 22 66 - Fax : (34) 91 348 22 66
http://www.inetsysonline.com
 
/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/


--=====_97318547241=_
Content-Type: text/html; charset="us-ascii"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META content="MSHTML 5.00.2920.0" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff style="FONT-FAMILY: Arial" text=#000000>
<DIV><FONT size=2>Hello, I have coded my own&nbsp;DTML tag and i want to catch a 
property of the folder&nbsp;where the&nbsp;DTML-Coded is. </FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2>How can i do this??? </FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2>from DocumentTemplate.DT_Util&nbsp;import *&nbsp;# useful 
parsing methods you'll need <BR>from DocumentTemplate.DT_String&nbsp;import 
String&nbsp;# explained later </FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2>class FuenteTag:</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2>&nbsp;&nbsp;&nbsp; name = 'fuente'&nbsp;&nbsp;&nbsp; 
blockContinuations=()<BR>&nbsp;&nbsp;&nbsp; expand=None</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2>&nbsp;&nbsp;&nbsp; def __init__(self, 
blocks):<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tname, args, section = 
blocks[0]<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
self.tname=tname<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
self.section=section<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
args=parse_params(args, font='Verdana', 
size='2')<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
self.args=args<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.font = 
args.get('font','Verdana')<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
self.size = args.get('size','2')<BR></FONT></DIV>
<DIV><FONT size=2>&nbsp;&nbsp;&nbsp; def render(self, 
md):<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cadena = '&lt;FONT 
FACE="'+self.font+'" SIZE="' + self.size + '"&gt;' 
+self.section(md)+'&lt;/FONT&gt;'<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return cadena</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2><BR>&nbsp;&nbsp;&nbsp; __call__ = render</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2>String.commands['fuente'] = FuenteTag 
<BR></FONT></DIV></BODY></HTML>

<BR>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META content="MSHTML 5.00.2920.0" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff style="FONT-FAMILY: Arial" text=#000000><FONT size=2>
<DIV><FONT size=2>/_/_<FONT size=2>/_/_<FONT size=2>/_/_<FONT size=2>/_/_<FONT 
size=2>/_/_<FONT size=2>/_/_<FONT size=2>/_/_<FONT size=2>/_/_<FONT 
size=2>/_/_<FONT size=2>/_/_<FONT size=2>/_/_<FONT size=2>/_/_<FONT 
size=2>/_/_<FONT 
size=2>/_/</FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV>Aitor Grajal Crespo</DIV>
<DIV><FONT size=2>Director General</FONT></DIV>
<DIV><FONT size=2>e-mail: <A 
href="mailto:Aitor.Grajal@inetsysonline.com">Aitor.Grajal@inetsysonline.com</A></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2>INETSYS, S.L.</FONT></DIV>
<DIV><FONT size=2>ETSI Informática</FONT></DIV>
<DIV><FONT size=2>Ctra. Colmenar, km. 15,500</FONT></DIV>
<DIV><FONT size=2>28049 MADRID</FONT></DIV>
<DIV><FONT size=2>SPAIN</FONT></DIV>
<DIV><FONT size=2>Tfno : (34) 91 348 22 66 - Fax : (34) 91 348 22 
66</FONT></DIV>
<DIV><FONT size=2><A 
href="http://www.inetsysonline.com/">http://www.inetsysonline.com</A></FONT></DIV>
<DIV><FONT size=2><FONT size=2></FONT></FONT>&nbsp;</DIV>
<DIV><FONT size=2><FONT size=2>/_/_<FONT size=2>/_/_<FONT size=2>/_/_<FONT 
size=2>/_/_<FONT size=2>/_/_<FONT size=2>/_/_<FONT size=2>/_/_<FONT 
size=2>/_/_<FONT size=2>/_/_<FONT size=2>/_/_<FONT size=2>/_/_<FONT 
size=2>/_/_<FONT size=2>/_/_<FONT 
size=2>/_/</FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></DIV></FONT></BODY></HTML>


--=====_97318547241=_--