[Zope] html_quote in Python script

Petter Enhom pe_zope@snapper.no
Thu, 12 Jun 2003 13:14:22 +0200


It's all written in the source :-)

This is the html_quote method used by dtml
(lib/python/DocumenTemplate/html_quote.py)

# split off into its own module for aliasing without circrefs

from cgi import escape
from ustr import ustr

def html_quote(v, name='(Unknown name)', md={}):
    return escape(ustr(v), 1)

I think also urllib can help you:

import urllib
print urllib.quote('this is a string')

Best regards
Petter Enholm

-----Original Message-----
From: zope-admin@zope.org [mailto:zope-admin@zope.org] On Behalf Of
Thierry FLORAC
Sent: 12. juni 2003 11:39
To: zope@zope.org
Subject: [Zope] html_quote in Python script



  Hi,

Is it possible, and how, to mimmic the "<dtml-var ... html_quote>"
statement 
in a Python script using "print ..." ??

Thanks,

  Thierry

-- 
  Linux every day, keeps Dr Watson away...
  http://gpc.sourceforge.net -- http://www.ulthar.net

_______________________________________________
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 )