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

2005-10-19 Thread Thomas G. Apostolou

I have an External Method CharSetConv that get a
String_To_Be_Converted, its encoding and the encoding to convert it
to.

I call it like this:
dtml-in sequence-item
tddtml-var expr=CharSetConv(_, 'String_To_Be_Converted',
'ISO-8859-7', 'UTF-8') /td
  /dtml-in
but in the place of 'String_To_Be_Converted' i want to pass dtml-var
sequence-item, and i can not find the way to do so.
i have tried to write it like:
dtml-in sequence-item
tddtml-var expr=CharSetConv(_, 'dtml-var sequence-item',
'ISO-8859-7', 'UTF-8') /td
  /dtml-in
but does not work
Can anyone help please?



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

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Pass dtml-var sequence-item as parameter to External Method

2005-10-19 Thread Tino Wildenhain

Thomas G. Apostolou schrieb:

I have an External Method CharSetConv that get a
String_To_Be_Converted, its encoding and the encoding to convert it
to.

I call it like this:
dtml-in sequence-item
tddtml-var expr=CharSetConv(_, 'String_To_Be_Converted',
'ISO-8859-7', 'UTF-8') /td
  /dtml-in
but in the place of 'String_To_Be_Converted' i want to pass dtml-var
sequence-item, and i can not find the way to do so.
i have tried to write it like:
dtml-in sequence-item
tddtml-var expr=CharSetConv(_, 'dtml-var sequence-item',
'ISO-8859-7', 'UTF-8') /td
  /dtml-in
but does not work
Can anyone help please?


Well, DTML sux for a reason ;)

but dtml-in sequence-item makes no sense unless you have list in list.

You dont need an external method to convert between charsets:

dtml-var
   expr=_['sequence-item'].decode('iso-8859-7').encode('utf-8') 

HTH
Tino

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Pass dtml-var sequence-item as parameter to External Method

2005-10-19 Thread Jonathan


- Original Message - 
From: Thomas G. Apostolou [EMAIL PROTECTED]

I have an External Method CharSetConv that get a
String_To_Be_Converted, its encoding and the encoding to convert it
to.

I call it like this:
dtml-in sequence-item
   tddtml-var expr=CharSetConv(_, 'String_To_Be_Converted',
'ISO-8859-7', 'UTF-8') /td
 /dtml-in
but in the place of 'String_To_Be_Converted' i want to pass dtml-var
sequence-item, and i can not find the way to do so.
i have tried to write it like:
dtml-in sequence-item
   tddtml-var expr=CharSetConv(_, 'dtml-var sequence-item',
'ISO-8859-7', 'UTF-8') /td
 /dtml-in
but does not work


You can't embedded dtml within dtml.  However, this should work:

dtml-var CharSetConv(_,_['sequence-item'])

hth

Jonathan


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Pass dtml-var sequence-item as parameter to External Method

2005-10-19 Thread Thomas G. Apostolou
Αρχικό μήνυμα από  Tino Wildenhain [EMAIL PROTECTED]:

 Thomas G. Apostolou schrieb:
  I have an External Method CharSetConv that get a
  String_To_Be_Converted, its encoding and the encoding to convert
 it
  to.
  
  I call it like this:
  dtml-in sequence-item
  tddtml-var expr=CharSetConv(_,
 'String_To_Be_Converted',
  'ISO-8859-7', 'UTF-8') /td
/dtml-in
  but in the place of 'String_To_Be_Converted' i want to pass
 dtml-var
  sequence-item, and i can not find the way to do so.
  i have tried to write it like:
  dtml-in sequence-item
  tddtml-var expr=CharSetConv(_, 'dtml-var
 sequence-item',
  'ISO-8859-7', 'UTF-8') /td
/dtml-in
  but does not work
  Can anyone help please?
 
 Well, DTML sux for a reason ;)
 
 but dtml-in sequence-item makes no sense unless you have list in
 list.
 
 You dont need an external method to convert between charsets:
 
 dtml-var
 expr=_['sequence-item'].decode('iso-8859-7').encode('utf-8') 
 
 HTH
 Tino

Dear friend thanks alot fro your reply.
I do have a lists in list
your sugestion return an error

Site error This site encountered an error trying to fulfill your
request. The errors were: 
Error Type 
AttributeError 
Error Value 
'NoneType' object has no attribute 'decode' 
Request made at 
2005/10/19 17:17:03.485 GMT+3 

what is wrong?




Thomas G. Apostolou
Software Engineer
Θωμάς Γ. Αποστόλου
Μηχανικός Λογισμικού
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Pass dtml-var sequence-item as parameter to External Method

2005-10-19 Thread Tino Wildenhain

Thomas G. Apostolou schrieb:

Αρχικό μήνυμα από  Tino Wildenhain [EMAIL PROTECTED]:



Thomas G. Apostolou schrieb:


I have an External Method CharSetConv that get a
String_To_Be_Converted, its encoding and the encoding to convert


it


to.

I call it like this:
dtml-in sequence-item
   tddtml-var expr=CharSetConv(_,


'String_To_Be_Converted',


'ISO-8859-7', 'UTF-8') /td
 /dtml-in
but in the place of 'String_To_Be_Converted' i want to pass


dtml-var


sequence-item, and i can not find the way to do so.
i have tried to write it like:
dtml-in sequence-item
   tddtml-var expr=CharSetConv(_, 'dtml-var


sequence-item',


'ISO-8859-7', 'UTF-8') /td
 /dtml-in
but does not work
Can anyone help please?


Well, DTML sux for a reason ;)

but dtml-in sequence-item makes no sense unless you have list in
list.

You dont need an external method to convert between charsets:

dtml-var
   expr=_['sequence-item'].decode('iso-8859-7').encode('utf-8') 

HTH
Tino



Dear friend thanks alot fro your reply.
I do have a lists in list
your sugestion return an error

Site error This site encountered an error trying to fulfill your
request. The errors were: 
Error Type 
AttributeError 
Error Value 
'NoneType' object has no attribute 'decode' 
Request made at 
2005/10/19 17:17:03.485 GMT+3 


what is wrong?


Looks like you have a None object among your strings in the list.
If so, you can either do:

dtml-if sequence-item dtml-var 
expr=_['sequence-item'].decode('iso-8859-7').encode('utf-8') 

/dtml-if

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



___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Pass dtml-var sequence-item as parameter to External Method

2005-10-19 Thread Thomas G. Apostolou
Αρχικό μήνυμα από  Tino Wildenhain [EMAIL PROTECTED]:

 Thomas G. Apostolou schrieb:
  Αρχικό μήνυμα από  Tino Wildenhain [EMAIL PROTECTED]:
  
  
 Thomas G. Apostolou schrieb:
 
 I have an External Method CharSetConv that get a
 String_To_Be_Converted, its encoding and the encoding to convert
 
 it
 
 to.
 
 I call it like this:
 dtml-in sequence-item
 tddtml-var expr=CharSetConv(_,
 
 'String_To_Be_Converted',
 
 'ISO-8859-7', 'UTF-8') /td
   /dtml-in
 but in the place of 'String_To_Be_Converted' i want to pass
 
 dtml-var
 
 sequence-item, and i can not find the way to do so.
 i have tried to write it like:
 dtml-in sequence-item
 tddtml-var expr=CharSetConv(_, 'dtml-var
 
 sequence-item',
 
 'ISO-8859-7', 'UTF-8') /td
   /dtml-in
 but does not work
 Can anyone help please?
 
 Well, DTML sux for a reason ;)
 
 but dtml-in sequence-item makes no sense unless you have list in
 list.
 
 You dont need an external method to convert between charsets:
 
 dtml-var
 expr=_['sequence-item'].decode('iso-8859-7').encode('utf-8')
 
 
 HTH
 Tino
  
  
  Dear friend thanks alot fro your reply.
  I do have a lists in list
  your sugestion return an error
  
  Site error This site encountered an error trying to fulfill your
  request. The errors were: 
  Error Type 
  AttributeError 
  Error Value 
  'NoneType' object has no attribute 'decode' 
  Request made at 
  2005/10/19 17:17:03.485 GMT+3 
  
  what is wrong?
 
 Looks like you have a None object among your strings in the list.
 If so, you can either do:
 
 dtml-if sequence-item dtml-var 
 expr=_['sequence-item'].decode('iso-8859-7').encode('utf-8') 
 /dtml-if
 
 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?

THANK YOU VERY MUCH ALLREADY!!!



Thomas G. Apostolou
Software Engineer
Θωμάς Γ. Αποστόλου
Μηχανικός Λογισμικού
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Pass dtml-var sequence-item as parameter to External Method

2005-10-19 Thread Tino Wildenhain

...

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.

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Pass dtml-var sequence-item as parameter to External Method

2005-10-19 Thread Thomas G. Apostolou
Αρχικό μήνυμα από  Tino Wildenhain [EMAIL PROTECTED]:

 ...
 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
Θωμάς Γ. Αποστόλου
Μηχανικός Λογισμικού
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )