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 = 'fuente' blockContinuations=() expand=None def __init__(self, blocks): tname, args, section = blocks[0] self.tname=tname self.section=section args=parse_params(args, font='Verdana', size='2') self.args=args self.font = args.get('font','Verdana') self.size = args.get('size','2') def render(self, md): cadena = '<FONT FACE="'+self.font+'" SIZE="' + self.size + '">' +self.section(md)+'</FONT>' return cadena __call__ = render String.commands['fuente'] = FuenteTag /_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ Aitor Grajal Crespo Director General e-mail: Aitor.Grajal@inetsysonline.com INETSYS, S.L. ETSI Informática Ctra. Colmenar, km. 15,500 28049 MADRID SPAIN Tfno : (34) 91 348 22 66 - Fax : (34) 91 348 22 66 http://www.inetsysonline.com /_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
I think that all you have to do is get your property out of md. ie: some_prop=md['some_prop']
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
/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
Yeahhh, thanks. But , one more step.....:-) ....can i do it in the init method ??? The init method no have the md parameter. no???
I think that all you have to do is get your property out of md.
ie: some_prop=md['some_prop']
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
/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ Aitor Grajal Crespo Director General e-mail: Aitor.Grajal@inetsysonline.com INETSYS, S.L. ETSI Inform�tica Ctra. Colmenar, km. 15,500 28049 MADRID SPAIN Tfno : (34) 91 348 22 66 - Fax : (34) 91 348 22 66 http://www.inetsysonline.com /_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
On 11/2/2000 3:12 PM, "Aitor Grajal Crespo" <Aitor.Grajal@inetsysonline.com> wrote:
Yeahhh, thanks.
But , one more step.....:-) ....can i do it in the init method ??? The init method no have the md parameter. no???
No, __init__ is called at parse time and has no knowledge of the surrounding environment. render\__call__ is called at render time when the namespace becomes important. Jeffrey P Shell, jeffrey@Digicool.com http://www.digicool.com/ | http://www.zope.org
participants (3)
-
Aitor Grajal Crespo -
Jeffrey P Shell -
Paul Erickson