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
13b51ae7
Commit
13b51ae7
authored
Apr 30, 2001
by
Shane Hathaway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed some re's
parent
30a9be8a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
41 deletions
+37
-41
lib/python/DocumentTemplate/DT_HTML.py
lib/python/DocumentTemplate/DT_HTML.py
+8
-8
lib/python/DocumentTemplate/DT_Let.py
lib/python/DocumentTemplate/DT_Let.py
+2
-2
lib/python/DocumentTemplate/DT_String.py
lib/python/DocumentTemplate/DT_String.py
+21
-21
lib/python/DocumentTemplate/DT_Util.py
lib/python/DocumentTemplate/DT_Util.py
+6
-10
No files found.
lib/python/DocumentTemplate/DT_HTML.py
View file @
13b51ae7
...
@@ -84,7 +84,7 @@
...
@@ -84,7 +84,7 @@
##############################################################################
##############################################################################
"""HTML formated DocumentTemplates
"""HTML formated DocumentTemplates
$Id: DT_HTML.py,v 1.2
6 2001/04/28 04:59:13 chrism
Exp $"""
$Id: DT_HTML.py,v 1.2
7 2001/04/30 14:46:00 shane
Exp $"""
from
DT_String
import
String
,
FileMixin
from
DT_String
import
String
,
FileMixin
import
DT_String
,
re
import
DT_String
,
re
...
@@ -94,10 +94,10 @@ from string import strip, find, split, join, rfind, replace
...
@@ -94,10 +94,10 @@ from string import strip, find, split, join, rfind, replace
class
dtml_re_class
:
class
dtml_re_class
:
""" This needs to be replaced before 2.4. It's a hackaround. """
""" This needs to be replaced before 2.4. It's a hackaround. """
def
search
(
self
,
text
,
start
=
0
,
def
search
(
self
,
text
,
start
=
0
,
name_match
=
re
.
compile
(
r
'[\000- ]*[a-zA-Z]+[\000- ]*'
).
match
,
name_match
=
re
.
compile
(
'[
\
000
- ]*[a-zA-Z]+[
\
000
- ]*'
).
match
,
end_match
=
re
.
compile
(
r
'[\000- ]*(/|end)'
,
re
.
I
).
match
,
end_match
=
re
.
compile
(
'[
\
000
- ]*(/|end)'
,
re
.
I
).
match
,
start_search
=
re
.
compile
(
r
'[<&]'
).
search
,
start_search
=
re
.
compile
(
'[<&]'
).
search
,
ent_name
=
re
.
compile
(
r
'[-a-zA-Z0-9_.]+'
).
match
,
ent_name
=
re
.
compile
(
'[-a-zA-Z0-9_.]+'
).
match
,
find
=
find
,
find
=
find
,
strip
=
strip
,
strip
=
strip
,
replace
=
replace
,
replace
=
replace
,
...
@@ -224,7 +224,7 @@ class HTML(DT_String.String):
...
@@ -224,7 +224,7 @@ class HTML(DT_String.String):
return
dtml_re_class
()
return
dtml_re_class
()
parseTag__roles__
=
()
parseTag__roles__
=
()
def
parseTag
(
self
,
tagre
,
command
=
None
,
sargs
=
''
):
def
parseTag
(
self
,
match_ob
,
command
=
None
,
sargs
=
''
):
"""Parse a tag using an already matched re
"""Parse a tag using an already matched re
Return: tag, args, command, coname
Return: tag, args, command, coname
...
@@ -236,7 +236,7 @@ class HTML(DT_String.String):
...
@@ -236,7 +236,7 @@ class HTML(DT_String.String):
coname is the name of a continue tag (e.g. else)
coname is the name of a continue tag (e.g. else)
or None otherwise
or None otherwise
"""
"""
tag
,
end
,
name
,
args
,
=
tagre
.
group
(
0
,
'end'
,
'name'
,
'args'
)
tag
,
end
,
name
,
args
=
match_ob
.
group
(
0
,
'end'
,
'name'
,
'args'
)
args
=
strip
(
args
)
args
=
strip
(
args
)
if
end
:
if
end
:
if
not
command
or
name
!=
command
.
name
:
if
not
command
or
name
!=
command
.
name
:
...
@@ -263,7 +263,7 @@ class HTML(DT_String.String):
...
@@ -263,7 +263,7 @@ class HTML(DT_String.String):
def
SubTemplate
(
self
,
name
):
return
HTML
(
''
,
__name__
=
name
)
def
SubTemplate
(
self
,
name
):
return
HTML
(
''
,
__name__
=
name
)
varExtra__roles__
=
()
varExtra__roles__
=
()
def
varExtra
(
self
,
tagre
):
return
's'
def
varExtra
(
self
,
match_ob
):
return
's'
manage_edit__roles__
=
()
manage_edit__roles__
=
()
def
manage_edit
(
self
,
data
,
REQUEST
=
None
):
def
manage_edit
(
self
,
data
,
REQUEST
=
None
):
...
...
lib/python/DocumentTemplate/DT_Let.py
View file @
13b51ae7
...
@@ -154,8 +154,8 @@ class Let:
...
@@ -154,8 +154,8 @@ class Let:
def
parse_let_params
(
text
,
def
parse_let_params
(
text
,
result
=
None
,
result
=
None
,
tag
=
'let'
,
tag
=
'let'
,
parmre
=
re
.
compile
(
r
'([\000- ]*([^\000- ="]+)=([^\000- ="]+))'
),
parmre
=
re
.
compile
(
'([
\
000
- ]*([^
\
000
- ="]+)=([^
\
000
- ="]+))'
),
qparmre
=
re
.
compile
(
r
'([\000- ]*([^\000- ="]+)="([^"]*)")'
),
qparmre
=
re
.
compile
(
'([
\
000
- ]*([^
\
000
- ="]+)="([^"]*)")'
),
**
parms
):
**
parms
):
result
=
result
or
[]
result
=
result
or
[]
...
...
lib/python/DocumentTemplate/DT_String.py
View file @
13b51ae7
...
@@ -82,7 +82,7 @@
...
@@ -82,7 +82,7 @@
# attributions are listed in the accompanying credits file.
# attributions are listed in the accompanying credits file.
#
#
##############################################################################
##############################################################################
"$Id: DT_String.py,v 1.4
3 2001/04/28 07:20:28 chrism
Exp $"
"$Id: DT_String.py,v 1.4
4 2001/04/30 14:46:00 shane
Exp $"
from
string
import
split
,
strip
from
string
import
split
,
strip
import
thread
,
re
import
thread
,
re
...
@@ -155,18 +155,18 @@ class String:
...
@@ -155,18 +155,18 @@ class String:
tagre__roles__
=
()
tagre__roles__
=
()
def
tagre
(
self
):
def
tagre
(
self
):
return
re
.
compile
(
return
re
.
compile
(
r'%('
# beginning
'%
\
\
('
# beginning
r'(?P<name>[a-zA-Z0-9_/.-]+)'
# tag name
'(?P<name>[a-zA-Z0-9_/.-]+)'
# tag name
r
'('
'('
r'[\000- ]+'
# space after tag name
'[
\
000
- ]+'
# space after tag name
r'(?P<args>([^)"]+("[^"]*")?)*)'
# arguments
'(?P<args>([^
\
\
)"]+("[^"]*")?)*)'
# arguments
r
')?'
')?'
r'
)(?P<fmt>[0-9]*[.]?[0-9]*[a-z]|[]![])'
# end
'
\
\
)(?P<fmt>[0-9]*[.]?[0-9]*[a-z]|[]![])'
# end
,
re
.
I
)
,
re
.
I
)
_parseTag__roles__
=
()
_parseTag__roles__
=
()
def
_parseTag
(
self
,
tagre
,
command
=
None
,
sargs
=
''
,
tt
=
type
(())):
def
_parseTag
(
self
,
match_ob
,
command
=
None
,
sargs
=
''
,
tt
=
type
(())):
tag
,
args
,
command
,
coname
=
self
.
parseTag
(
tagre
,
command
,
sargs
)
tag
,
args
,
command
,
coname
=
self
.
parseTag
(
match_ob
,
command
,
sargs
)
if
type
(
command
)
is
tt
:
if
type
(
command
)
is
tt
:
cname
,
module
,
name
=
command
cname
,
module
,
name
=
command
d
=
{}
d
=
{}
...
@@ -179,7 +179,7 @@ class String:
...
@@ -179,7 +179,7 @@ class String:
return
tag
,
args
,
command
,
coname
return
tag
,
args
,
command
,
coname
parseTag__roles__
=
()
parseTag__roles__
=
()
def
parseTag
(
self
,
tagre
,
command
=
None
,
sargs
=
''
):
def
parseTag
(
self
,
match_ob
,
command
=
None
,
sargs
=
''
):
"""Parse a tag using an already matched re
"""Parse a tag using an already matched re
Return: tag, args, command, coname
Return: tag, args, command, coname
...
@@ -191,7 +191,7 @@ class String:
...
@@ -191,7 +191,7 @@ class String:
coname is the name of a continue tag (e.g. else)
coname is the name of a continue tag (e.g. else)
or None otherwise
or None otherwise
"""
"""
tag
,
name
,
args
,
fmt
=
tagre
.
group
(
0
,
'name'
,
'args'
,
'fmt'
)
tag
,
name
,
args
,
fmt
=
match_ob
.
group
(
0
,
'name'
,
'args'
,
'fmt'
)
args
=
args
and
strip
(
args
)
or
''
args
=
args
and
strip
(
args
)
or
''
if
fmt
==
']'
:
if
fmt
==
']'
:
...
@@ -220,18 +220,18 @@ class String:
...
@@ -220,18 +220,18 @@ class String:
return
tag
,
args
,
Var
,
None
return
tag
,
args
,
Var
,
None
varExtra__roles__
=
()
varExtra__roles__
=
()
def
varExtra
(
self
,
tagre
):
def
varExtra
(
self
,
match_ob
):
return
tagre
.
group
(
'fmt'
)
return
match_ob
.
group
(
'fmt'
)
parse__roles__
=
()
parse__roles__
=
()
def
parse
(
self
,
text
,
start
=
0
,
result
=
None
,
tagre
=
None
):
def
parse
(
self
,
text
,
start
=
0
,
result
=
None
,
tagre
=
None
):
if
result
is
None
:
result
=
[]
if
result
is
None
:
result
=
[]
if
tagre
is
None
:
tagre
=
self
.
tagre
()
if
tagre
is
None
:
tagre
=
self
.
tagre
()
mo
=
tagre
.
search
(
text
,
start
)
mo
=
tagre
.
search
(
text
,
start
)
while
mo
:
while
mo
:
l
=
mo
.
start
(
0
)
l
=
mo
.
start
(
0
)
try
:
tag
,
args
,
command
,
coname
=
self
.
_parseTag
(
tagre
)
try
:
tag
,
args
,
command
,
coname
=
self
.
_parseTag
(
mo
)
except
ParseError
,
m
:
self
.
parse_error
(
m
[
0
],
m
[
1
],
text
,
l
)
except
ParseError
,
m
:
self
.
parse_error
(
m
[
0
],
m
[
1
],
text
,
l
)
s
=
text
[
start
:
l
]
s
=
text
[
start
:
l
]
...
@@ -243,7 +243,7 @@ class String:
...
@@ -243,7 +243,7 @@ class String:
tag
,
l
,
args
,
command
)
tag
,
l
,
args
,
command
)
else
:
else
:
try
:
try
:
if
command
is
Var
:
r
=
command
(
args
,
self
.
varExtra
(
tagre
))
if
command
is
Var
:
r
=
command
(
args
,
self
.
varExtra
(
mo
))
else
:
r
=
command
(
args
)
else
:
r
=
command
(
args
)
if
hasattr
(
r
,
'simple_form'
):
r
=
r
.
simple_form
if
hasattr
(
r
,
'simple_form'
):
r
=
r
.
simple_form
result
.
append
(
r
)
result
.
append
(
r
)
...
@@ -256,7 +256,7 @@ class String:
...
@@ -256,7 +256,7 @@ class String:
return
result
return
result
skip_eol__roles__
=
()
skip_eol__roles__
=
()
def
skip_eol
(
self
,
text
,
start
,
eol
=
re
.
compile
(
r
'[ \t]*\n'
)):
def
skip_eol
(
self
,
text
,
start
,
eol
=
re
.
compile
(
'[
\
t
]*
\
n
'
)):
# if block open is followed by newline, then skip past newline
# if block open is followed by newline, then skip past newline
mo
=
eol
.
match
(
text
,
start
)
mo
=
eol
.
match
(
text
,
start
)
if
mo
is
not
None
:
if
mo
is
not
None
:
...
@@ -281,7 +281,7 @@ class String:
...
@@ -281,7 +281,7 @@ class String:
if
mo
is
None
:
self
.
parse_error
(
'No closing tag'
,
stag
,
text
,
sloc
)
if
mo
is
None
:
self
.
parse_error
(
'No closing tag'
,
stag
,
text
,
sloc
)
l
=
mo
.
start
(
0
)
l
=
mo
.
start
(
0
)
try
:
tag
,
args
,
command
,
coname
=
self
.
_parseTag
(
tagre
,
scommand
,
sa
)
try
:
tag
,
args
,
command
,
coname
=
self
.
_parseTag
(
mo
,
scommand
,
sa
)
except
ParseError
,
m
:
self
.
parse_error
(
m
[
0
],
m
[
1
],
text
,
l
)
except
ParseError
,
m
:
self
.
parse_error
(
m
[
0
],
m
[
1
],
text
,
l
)
if
command
:
if
command
:
...
@@ -320,7 +320,7 @@ class String:
...
@@ -320,7 +320,7 @@ class String:
if
mo
is
None
:
self
.
parse_error
(
'No closing tag'
,
stag
,
text
,
sloc
)
if
mo
is
None
:
self
.
parse_error
(
'No closing tag'
,
stag
,
text
,
sloc
)
l
=
mo
.
start
(
0
)
l
=
mo
.
start
(
0
)
try
:
tag
,
args
,
command
,
coname
=
self
.
_parseTag
(
tagre
,
scommand
,
sa
)
try
:
tag
,
args
,
command
,
coname
=
self
.
_parseTag
(
mo
,
scommand
,
sa
)
except
ParseError
,
m
:
self
.
parse_error
(
m
[
0
],
m
[
1
],
text
,
l
)
except
ParseError
,
m
:
self
.
parse_error
(
m
[
0
],
m
[
1
],
text
,
l
)
start
=
l
+
len
(
tag
)
start
=
l
+
len
(
tag
)
...
...
lib/python/DocumentTemplate/DT_Util.py
View file @
13b51ae7
...
@@ -82,8 +82,8 @@
...
@@ -82,8 +82,8 @@
# attributions are listed in the accompanying credits file.
# attributions are listed in the accompanying credits file.
#
#
##############################################################################
##############################################################################
'''$Id: DT_Util.py,v 1.7
5 2001/04/28 04:58:53 chrism
Exp $'''
'''$Id: DT_Util.py,v 1.7
6 2001/04/30 14:46:00 shane
Exp $'''
__version__
=
'$Revision: 1.7
5
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.7
6
$'
[
11
:
-
2
]
import
re
,
os
import
re
,
os
from
string
import
lower
from
string
import
lower
...
@@ -339,14 +339,10 @@ ListType=type([])
...
@@ -339,14 +339,10 @@ ListType=type([])
def
parse_params
(
text
,
def
parse_params
(
text
,
result
=
None
,
result
=
None
,
tag
=
''
,
tag
=
''
,
unparmre
=
re
.
compile
(
unparmre
=
re
.
compile
(
'([
\
000
- ]*([^
\
000
- ="]+))'
),
r'([\000- ]*([^\000- ="]+))'
),
qunparmre
=
re
.
compile
(
'([
\
000
- ]*("[^"]*"))'
),
qunparmre
=
re
.
compile
(
parmre
=
re
.
compile
(
'([
\
000
- ]*([^
\
000
- ="]+)=([^
\
000
- ="]+))'
),
r'([\000- ]*("[^"]*"))'
),
qparmre
=
re
.
compile
(
'([
\
000
- ]*([^
\
000
- ="]+)="([^"]*)")'
),
parmre
=
re
.
compile
(
r'([\000- ]*([^\000- ="]+)=([^\000- ="]+))'
),
qparmre
=
re
.
compile
(
r'([\000- ]*([^\000- ="]+)="([^"]*)")'
),
**
parms
):
**
parms
):
"""Parse tag parameters
"""Parse tag parameters
...
...
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