Re: [Zope] I want to use html_quote as a function

2000-10-16 Thread Kapil Thangavelu

Hello,


"Ryan M. Dolensek" wrote:
> 
> try...
> 
>  "REQUEST.set('htmldesc',utils.httpEscapedString(REQUEST['description']))">


huh??, what is this, i'm not aware of anything resembling this being in
zope's core, i think you are using some type of custom lib. if not i'd
like to hear about it?

> ryan
> 
> Soren Roug wrote:
> 
> > Hi,
> >
> > I can render text that potentially has html in it safely with
> >
> > 
> >
> > but what if I want to assign the quoted result to another variable.
> >
> > I tried
> >
> > 
> >
> > It didn't work. How do I solve this problem?

the html_quote of dtml-var is done on rendering so you really can't
capture the variable in a transformed state. 

the solution is to roll your own pythonmethod. here's one to the trick.


html_encode ttw python method
PARAMETERS: text

BODY
string = _.string

character_entities={"'&'":"&","<":"<",
"'>'":">","\213": '<',
   
"\233":'>','"':"""}  
text=str(text)
for re,name in character_entities.items():
if string.find(text, re) >= 0:
text=string.join(string.split(text,re),name)
return text
/END BODY


so for your example you would do



qualifying description if you need to.


cheers

kapil

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




Re: [Zope] I want to use html_quote as a function

2000-10-16 Thread Ryan M. Dolensek

try...



ryan

Soren Roug wrote:

> Hi,
>
> I can render text that potentially has html in it safely with
>
> 
>
> but what if I want to assign the quoted result to another variable.
>
> I tried
>
> 
>
> It didn't work. How do I solve this problem?
>
> Sincerely yours,
>
> Soren Roug
>
> ___
> Zope maillist  -  [EMAIL PROTECTED]
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )

--
Ryan Dolensek
Software Engineer
Global Crossing
(920)405-4812
[EMAIL PROTECTED]



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




[Zope] I want to use html_quote as a function

2000-10-16 Thread Soren Roug

Hi,

I can render text that potentially has html in it safely with



but what if I want to assign the quoted result to another variable.

I tried



It didn't work. How do I solve this problem?

Sincerely yours,

Soren Roug

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