Skip to content

Commit

Permalink
Collector #186, added urlencode to PythonScripts.standard
Browse files Browse the repository at this point in the history
  • Loading branch information
caseman committed Aug 16, 2002
1 parent 7bf1f8a commit 7bd9225
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
26 changes: 17 additions & 9 deletions help/standard.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,19 @@ 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
'+'. This is needed for building query strings in some cases.
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.
"""
Expand All @@ -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.
"""
Expand All @@ -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):
"""
Expand Down
5 changes: 3 additions & 2 deletions standard.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"import Products.PythonScripts.standard"
"""

__version__='$Revision: 1.9 $'[11:-2]
__version__='$Revision: 1.10 $'[11:-2]

from AccessControl import ModuleSecurityInfo, getSecurityManager
security = ModuleSecurityInfo()
Expand All @@ -28,11 +28,12 @@
'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
Expand Down

0 comments on commit 7bd9225

Please sign in to comment.