[Zope] Pass <dtml-var sequence-item> as parameter to External Method

Thomas G. Apostolou thomas.info at hol.gr
Wed Oct 19 11:11:04 EDT 2005


Αρχικό μήνυμα από  Tino Wildenhain <tino at wildenhain.de>:

> ...
> >>which is the quick & dirty variant, or:
> >><dtml-var expr="(_['sequence-item'] or 
> >>"").decode('iso-8859-7').encode('utf-8')" >
> >>
> >>Which uses a "boolean trick".
> >>
> >>HTH
> >>Tino
> >>
> >>PS: get used to python scripts where this is a lot better
> >>to write
> > 
> > 
> > I agree with you and i would write this in python script (if this
> was
> > not an emegerncy and i was not a niewbie)
> > There one more thing to solve. Not all my elements in the list are
> > strings. If i was writing python i would use
> > for i,elem in enumerate(data):
> >     for j,ele in enumerate(elem):
> >         if isinstance(ele,(str,unicode)):
> >             print unicode(ele,'iso-8859-7').encode('utf-8')
> > what is the corresponding dtml-if to check if sequence-item is a
> > string?
> 
> there is same_type to check. But you could just do:
> 
> <dtml-var expr="str(_['sequence-item'] or 
> "").decode('iso-8859-7').encode('utf-8')" >
> 
> basically turn everything into a string.
> 
> 

THATS VERY HELPFULL OF YOU THANKS THANKS THANKS!
NEXT TIME I' M GONNA SAY 
"NO I DO NOT KNOW WHEN IT'LL BE READY CAUSE I AM A NIEWBIE AND DON' T
LIKE TO DO THINGS THE DIRTY WAY"


Thomas G. Apostolou
Software Engineer
Θωμάς Γ. Αποστόλου
Μηχανικός Λογισμικού


More information about the Zope mailing list