Commit 4949da95 authored by Casey Duncan's avatar Casey Duncan

Collector #186, added urlencode to PythonScripts.standard

parent fffa0a8e
......@@ -118,6 +118,9 @@ Zope Changes
- #178: Don't compile PythonScripts in skins directories
Features Added
- Collector #186: Added urlencode to the standard importables for
Python scripts.
- <dtml-var name> and &dtml.-name; will now automatically HTML-quote
unsafe data taken implictly from the REQUEST object. Data taken
......
......@@ -51,12 +51,11 @@ def url_quote(s):
See Also
"Python 'urllib'
module":http://www.python.org/doc/current/lib/module-urllib.html
"Python 'urllib' module":http://www.python.org/doc/current/lib/module-urllib.html
'quote' function.
"""
def url_quote_plus(s):
"""
Like url_quote but also replace blank space characters with
......@@ -64,8 +63,7 @@ def url_quote_plus(s):
See Also
"Python 'urllib'
module":http://www.python.org/doc/current/lib/module-urllib.html
"Python 'urllib' module":http://www.python.org/doc/current/lib/module-urllib.html
'quote_plus' function.
"""
......@@ -77,8 +75,7 @@ def url_unquote(s):
See Also
"Python 'urllib'
module":http://www.python.org/doc/current/lib/module-urllib.html
"Python 'urllib' module":http://www.python.org/doc/current/lib/module-urllib.html
'unquote' function.
"""
......@@ -89,11 +86,22 @@ def url_unquote_plus(s):
See Also
"Python 'urllib'
module":http://www.python.org/doc/current/lib/module-urllib.html
"Python 'urllib' module":http://www.python.org/doc/current/lib/module-urllib.html
'unquote_plus' function.
"""
def urlencode(query, doseq=0):
"""
Convert a mapping object (such as a dictionary) or a sequence of
two-element tuples to a URL encoded query string. Useful for generating
query strings programmatically.
See Also
"Python 'urllib' module":http://www.python.org/doc/current/lib/module-urllib.html
'urlencode' function.
"""
def newline_to_br(s):
"""
......
......@@ -18,7 +18,7 @@ Scripts. It can be accessed from Python with the statement
"import Products.PythonScripts.standard"
"""
__version__='$Revision: 1.9 $'[11:-2]
__version__='$Revision: 1.10 $'[11:-2]
from AccessControl import ModuleSecurityInfo, getSecurityManager
security = ModuleSecurityInfo()
......@@ -28,11 +28,12 @@ security.declarePublic('special_formats', 'whole_dollars',
'sql_quote', 'html_quote', 'url_quote',
'url_quote_plus', 'newline_to_br',
'thousands_commas', 'url_unquote',
'url_unquote_plus')
'url_unquote_plus', 'urlencode')
from DocumentTemplate.DT_Var import special_formats, \
whole_dollars, dollars_and_cents, structured_text, sql_quote, \
html_quote, url_quote, url_quote_plus, newline_to_br, thousands_commas, \
url_unquote, url_unquote_plus
from urllib import urlencode
from Globals import HTML
from AccessControl.DTML import RestrictedDTML
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment