Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
22a8ae9b
Commit
22a8ae9b
authored
Oct 28, 1999
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added submitted url_quote_plus format and moved imports out of the
function bodies for the url quoting functions.
parent
aa8905f9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
6 deletions
+16
-6
lib/python/DocumentTemplate/DT_Var.py
lib/python/DocumentTemplate/DT_Var.py
+16
-6
No files found.
lib/python/DocumentTemplate/DT_Var.py
View file @
22a8ae9b
...
...
@@ -167,6 +167,10 @@ __doc__='''Variable insertion parameters
'url_quote' -- convert characters that have special meaning
in URLS to HTML character entities using decimal values.
'url_quote_plus' -- like url_quote but also replace blank
space characters with '+'. This is needed for building
query strings in some cases.
'sql_quote' -- Convert single quotes to pairs of single
quotes. This is needed to safely include values in
Standard Query Language (SQL) strings.
...
...
@@ -198,12 +202,13 @@ Evaluating expressions without rendering results
'''
# '
__rcs_id__
=
'$Id: DT_Var.py,v 1.3
1 1999/10/22 17:32:25 jim
Exp $'
__version__
=
'$Revision: 1.3
1
$'
[
11
:
-
2
]
__rcs_id__
=
'$Id: DT_Var.py,v 1.3
2 1999/10/28 19:11:23 brian
Exp $'
__version__
=
'$Revision: 1.3
2
$'
[
11
:
-
2
]
from
DT_Util
import
parse_params
,
name_param
,
html_quote
,
str
import
regex
,
string
,
sys
,
regex
from
string
import
find
,
split
,
join
,
atoi
,
rfind
from
urllib
import
quote
,
quote_plus
class
Var
:
name
=
'var'
...
...
@@ -215,6 +220,7 @@ class Var:
capitalize
=
1
,
spacify
=
1
,
null
=
''
,
fmt
=
's'
,
size
=
0
,
etc
=
'...'
,
thousands_commas
=
1
,
html_quote
=
1
,
url_quote
=
1
,
sql_quote
=
1
,
url_quote_plus
=
1
,
newline_to_br
=
1
,
url
=
1
)
self
.
args
=
args
...
...
@@ -320,8 +326,11 @@ class Call:
def
url_quote
(
v
,
name
=
'(Unknown name)'
,
md
=
{}):
import
urllib
return
urllib
.
quote
(
str
(
v
))
return
quote
(
str
(
v
))
def
url_quote_plus
(
v
,
name
=
'(Unknown name)'
,
md
=
{}):
return
quote_plus
(
str
(
v
))
def
newline_to_br
(
v
,
name
=
'(Unknown name)'
,
md
=
{}):
v
=
str
(
v
)
...
...
@@ -404,8 +413,9 @@ def spacify(val):
if
find
(
val
,
'_'
)
>=
0
:
val
=
join
(
split
(
val
,
'_'
))
return
val
modifiers
=
(
html_quote
,
url_quote
,
newline_to_br
,
string
.
lower
,
string
.
upper
,
string
.
capitalize
,
spacify
,
thousands_commas
,
sql_quote
)
modifiers
=
(
html_quote
,
url_quote
,
url_quote_plus
,
newline_to_br
,
string
.
lower
,
string
.
upper
,
string
.
capitalize
,
spacify
,
thousands_commas
,
sql_quote
)
modifiers
=
map
(
lambda
f
:
(
f
.
__name__
,
f
),
modifiers
)
class
Comment
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment