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
a45df748
Commit
a45df748
authored
Mar 18, 1999
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a couple of minor performance tweaks after profiling.
parent
3132af40
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
13 deletions
+15
-13
lib/python/DocumentTemplate/DT_HTML.py
lib/python/DocumentTemplate/DT_HTML.py
+9
-8
lib/python/DocumentTemplate/gparse.py
lib/python/DocumentTemplate/gparse.py
+6
-5
No files found.
lib/python/DocumentTemplate/DT_HTML.py
View file @
a45df748
...
...
@@ -84,7 +84,7 @@
##############################################################################
"""HTML formated DocumentTemplates
$Id: DT_HTML.py,v 1.1
5 1999/03/10 00:15:07 klm
Exp $"""
$Id: DT_HTML.py,v 1.1
6 1999/03/18 15:07:03 brian
Exp $"""
from
DT_String
import
String
,
FileMixin
import
DT_String
,
regex
...
...
@@ -97,6 +97,8 @@ class dtml_re_class:
name_match
=
regex
.
compile
(
'[
\
0
- ]*[a-zA-Z]+[
\
0
- ]*'
).
match
,
end_match
=
regex
.
compile
(
'[
\
0
- ]*
\
(/
\
|end
\
)
'
,
regex.casefold).match,
find=find,
strip=strip
):
s=find(text,'
<
!
--
#',start)
if
s
<
0
:
return
s
...
...
@@ -128,13 +130,12 @@ class dtml_re_class:
return
s
def
group
(
self
,
*
args
):
g
=
self
.
__dict__
if
len
(
args
)
==
1
:
return
g
[
args
[
0
]]
r
=
[]
for
arg
in
args
:
r
.
append
(
g
[
arg
])
return
tuple
(
r
)
def
group
(
self
,
*
args
):
get
=
self
.
__dict__
.
get
if
len
(
args
)
==
1
:
return
get
(
args
[
0
])
return
tuple
(
map
(
get
,
args
))
class
HTML
(
DT_String
.
String
):
...
...
lib/python/DocumentTemplate/gparse.py
View file @
a45df748
...
...
@@ -82,7 +82,7 @@
# attributions are listed in the accompanying credits file.
#
##############################################################################
"$Id: gparse.py,v 1.
9 1999/03/10 00:15:08 klm
Exp $"
"$Id: gparse.py,v 1.
10 1999/03/18 15:07:03 brian
Exp $"
import
sys
,
parser
,
symbol
,
token
from
symbol
import
test
,
suite
,
argument
,
arith_expr
,
shift_expr
...
...
@@ -97,10 +97,11 @@ from parser import sequence2ast, compileast, ast2list
ParseError
=
'Expression Parse Error'
def
munge
(
ast
):
if
ISTERMINAL
(
ast
[
0
]):
return
def
munge
(
ast
,
STAR
=
STAR
,
DOT
=
DOT
,
LSQB
=
LSQB
,
COLON
=
COLON
,
trailer
=
trailer
):
ast0
=
ast
[
0
]
if
ISTERMINAL
(
ast0
):
return
else
:
if
ast
[
0
]
==
term
and
len
(
ast
)
>
2
:
if
ast
0
==
term
and
len
(
ast
)
>
2
:
keep_going
=
1
while
keep_going
:
keep_going
=
0
...
...
@@ -113,7 +114,7 @@ def munge(ast):
for
a
in
ast
[
1
:]:
munge
(
a
)
elif
ast
[
0
]
==
power
:
elif
ast
0
==
power
:
keep_going
=
1
while
keep_going
:
keep_going
=
0
...
...
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