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
fb76d2fc
Commit
fb76d2fc
authored
Jul 15, 1999
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Checked in Scott Robertson's thread-safety fixes.
parent
f734e9e1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
13 deletions
+21
-13
lib/python/OFS/DTMLMethod.py
lib/python/OFS/DTMLMethod.py
+21
-13
No files found.
lib/python/OFS/DTMLMethod.py
View file @
fb76d2fc
...
@@ -84,7 +84,7 @@
...
@@ -84,7 +84,7 @@
##############################################################################
##############################################################################
"""DTML Method objects."""
"""DTML Method objects."""
__version__
=
'$Revision: 1.2
7
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.2
8
$'
[
11
:
-
2
]
from
Globals
import
HTML
,
HTMLFile
,
MessageDialog
from
Globals
import
HTML
,
HTMLFile
,
MessageDialog
from
string
import
join
,
split
,
strip
,
rfind
,
atoi
,
lower
from
string
import
join
,
split
,
strip
,
rfind
,
atoi
,
lower
...
@@ -96,7 +96,7 @@ from AccessControl.Role import RoleManager
...
@@ -96,7 +96,7 @@ from AccessControl.Role import RoleManager
from
webdav.common
import
rfc1123_date
from
webdav.common
import
rfc1123_date
from
DateTime.DateTime
import
DateTime
from
DateTime.DateTime
import
DateTime
from
urllib
import
quote
from
urllib
import
quote
import
regex
,
Globals
,
sys
,
Acquisition
import
ts_
regex
,
Globals
,
sys
,
Acquisition
class
DTMLMethod
(
cDocument
,
HTML
,
Acquisition
.
Implicit
,
RoleManager
,
class
DTMLMethod
(
cDocument
,
HTML
,
Acquisition
.
Implicit
,
RoleManager
,
...
@@ -335,34 +335,42 @@ class DTMLMethod(cDocument, HTML, Acquisition.Implicit, RoleManager,
...
@@ -335,34 +335,42 @@ class DTMLMethod(cDocument, HTML, Acquisition.Implicit, RoleManager,
def
decapitate
(
html
,
RESPONSE
=
None
,
def
decapitate
(
html
,
RESPONSE
=
None
,
header_re
=
regex
.
compile
(
header_re
=
ts_
regex
.
compile
(
'
\
(
\
('
'
\
(
\
('
'[^
\
n
\
0
\
- <>:]+:[^
\
n]*
\
n
'
'[^
\
n
\
0
\
- <>:]+:[^
\
n]*
\
n
'
'
\
|
'
'
\
|
'
'
[
\
t
]
+
[
^
\
0
\
-
][
^
\
n
]
*
\
n
'
'
[
\
t
]
+
[
^
\
0
\
-
][
^
\
n
]
*
\
n
'
'
\
)
+
\
)[
\
t
]
*
\
n
\
([
\
0
-
\
377
]
+
\
)
'
'
\
)
+
\
)[
\
t
]
*
\
n
\
([
\
0
-
\
377
]
+
\
)
'
),
),
space_re=regex.compile('
\
([
\
t
]
+
\
)
'),
space_re=
ts_
regex.compile('
\
([
\
t
]
+
\
)
'),
name_re=regex.compile('
\
([
^
\
0
\
-
<>
:]
+
\
):
\
([
^
\
n
]
*
\
)
'),
name_re=
ts_
regex.compile('
\
([
^
\
0
\
-
<>
:]
+
\
):
\
([
^
\
n
]
*
\
)
'),
):
):
if header_re.match(html) < 0:
ts_results = header_re.match_group(html, (1,3))
if not ts_results:
return html
return html
headers, html =
header_re.group(1,3)
headers, html =
ts_results[1]
headers=split(headers,'
\
n
')
headers=split(headers,'
\
n
')
i=1
i=1
while i < len(headers):
while i < len(headers):
if not headers[i]:
if not headers[i]:
del headers[i]
del headers[i]
elif space_re.match(headers[i]) >= 0:
continue
ts_results = space_re.match_group(headers[i], (1,))
if ts_results:
headers[i-1]="%s %s" % (headers[i-1],
headers[i-1]="%s %s" % (headers[i-1],
headers[i][len(
space_re.group(1)
):])
headers[i][len(
ts_results[1]
):])
del headers[i]
del headers[i]
else:
continue
i=i+1
i=i+1
for i in range(len(headers)):
for i in range(len(headers)):
if name_re.match(headers[i]) >= 0:
ts_results = name_re.match_group(headers[i], (1,2))
k, v = name_re.group(1,2)
if ts_results:
k, v = ts_results[1]
v=strip(v)
v=strip(v)
else:
else:
raise ValueError, '
Invalid
Header
(
%
d
):
%
s
' % (i,headers[i])
raise ValueError, '
Invalid
Header
(
%
d
):
%
s
' % (i,headers[i])
...
...
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