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
7997adf2
Commit
7997adf2
authored
Sep 25, 1997
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed problem in reporting errors
parent
7dc06699
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
16 deletions
+33
-16
lib/python/DocumentTemplate/DT_HTML.py
lib/python/DocumentTemplate/DT_HTML.py
+5
-2
lib/python/DocumentTemplate/DT_If.py
lib/python/DocumentTemplate/DT_If.py
+8
-4
lib/python/DocumentTemplate/DT_In.py
lib/python/DocumentTemplate/DT_In.py
+9
-4
lib/python/DocumentTemplate/DT_Util.py
lib/python/DocumentTemplate/DT_Util.py
+11
-6
No files found.
lib/python/DocumentTemplate/DT_HTML.py
View file @
7997adf2
"""HTML formated DocumentTemplates
$Id: DT_HTML.py,v 1.
3 1997/09/22 14:42:08
jim Exp $"""
$Id: DT_HTML.py,v 1.
4 1997/09/25 18:56:37
jim Exp $"""
from
DT_String
import
String
,
FileMixin
import
DT_Doc
,
DT_String
,
regex
...
...
@@ -38,7 +38,7 @@ class HTML(DT_String.String):
args=strip(args)
if end:
if not command or name != command.name:
raise ParseError,
'unexpected end tag'
raise ParseError,
('unexpected end tag', tag)
return tag, args, None, None
if command and name in command.blockContinuations:
...
...
@@ -178,6 +178,9 @@ class HTMLFile(FileMixin, HTML):
##########################################################################
#
# $Log: DT_HTML.py,v $
# Revision 1.4 1997/09/25 18:56:37 jim
# fixed problem in reporting errors
#
# Revision 1.3 1997/09/22 14:42:08 jim
# *** empty log message ***
#
...
...
lib/python/DocumentTemplate/DT_If.py
View file @
7997adf2
...
...
@@ -110,8 +110,8 @@ __doc__='''Conditional insertion
# (540) 371-6909
#
############################################################################
__rcs_id__
=
'$Id: DT_If.py,v 1.
3 1997/09/22 14:42:49
jim Exp $'
__version__
=
'$Revision: 1.
3
$'
[
11
:
-
2
]
__rcs_id__
=
'$Id: DT_If.py,v 1.
4 1997/09/25 18:56:38
jim Exp $'
__version__
=
'$Revision: 1.
4
$'
[
11
:
-
2
]
from
DT_Util
import
*
...
...
@@ -136,12 +136,13 @@ class If:
if
args
:
ename
,
expr
=
name_param
(
args
,
'else'
,
1
)
if
ename
!=
name
:
raise
ParseError
,
'name in else does not match if'
raise
ParseError
,
(
'name in else does not match if'
,
'in'
)
self
.
elses
=
section
for
tname
,
args
,
section
in
blocks
[
1
:]:
if
tname
==
'else'
:
raise
ParseError
,
'more than one else tag for a single if tag'
raise
ParseError
,
(
'more than one else tag for a single if tag'
,
'in'
)
args
=
parse_params
(
args
,
name
=
''
,
expr
=
''
)
name
,
expr
=
name_param
(
args
,
'elif'
,
1
)
self
.
sections
.
append
((
name
,
expr
,
section
))
...
...
@@ -184,6 +185,9 @@ class Else:
##########################################################################
#
# $Log: DT_If.py,v $
# Revision 1.4 1997/09/25 18:56:38 jim
# fixed problem in reporting errors
#
# Revision 1.3 1997/09/22 14:42:49 jim
# added expr
#
...
...
lib/python/DocumentTemplate/DT_In.py
View file @
7997adf2
...
...
@@ -212,7 +212,7 @@
of the module 'Missing', if present.
'''
__rcs_id__
=
'$Id: DT_In.py,v 1.
3 1997/09/22 14:42:50
jim Exp $'
__rcs_id__
=
'$Id: DT_In.py,v 1.
4 1997/09/25 18:56:38
jim Exp $'
############################################################################
# Copyright
...
...
@@ -266,7 +266,7 @@ __rcs_id__='$Id: DT_In.py,v 1.3 1997/09/22 14:42:50 jim Exp $'
# (540) 371-6909
#
############################################################################
__version__
=
'$Revision: 1.
3
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
4
$'
[
11
:
-
2
]
from
DT_Util
import
*
...
...
@@ -286,13 +286,15 @@ class In:
self
.
__name__
,
expr
=
name
,
expr
self
.
section
=
section
if
len
(
blocks
)
>
1
:
if
len
(
blocks
)
!=
2
:
raise
ParseError
,
'too many else blocks'
if
len
(
blocks
)
!=
2
:
raise
ParseError
,
(
'too many else blocks'
,
'in'
)
tname
,
args
,
section
=
blocks
[
1
]
args
=
parse_params
(
args
,
name
=
''
)
if
args
:
ename
=
name_param
(
args
)
if
ename
!=
name
:
raise
ParseError
,
'name in else does not match in'
raise
ParseError
,
(
'name in else does not match in'
,
'in'
)
self
.
elses
=
section
...
...
@@ -718,6 +720,9 @@ class sequence_variables:
############################################################################
# $Log: DT_In.py,v $
# Revision 1.4 1997/09/25 18:56:38 jim
# fixed problem in reporting errors
#
# Revision 1.3 1997/09/22 14:42:50 jim
# added expr
#
...
...
lib/python/DocumentTemplate/DT_Util.py
View file @
7997adf2
'''$Id: DT_Util.py,v 1.
3 1997/09/22 14:42:50
jim Exp $'''
'''$Id: DT_Util.py,v 1.
4 1997/09/25 18:56:39
jim Exp $'''
############################################################################
# Copyright
...
...
@@ -52,7 +52,7 @@
# (540) 371-6909
#
############################################################################
__version__
=
'$Revision: 1.
3
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
4
$'
[
11
:
-
2
]
import
sys
,
regex
,
string
,
types
,
math
,
os
from
string
import
rfind
,
strip
,
joinfields
,
atoi
,
lower
,
upper
,
capitalize
...
...
@@ -101,10 +101,11 @@ def name_param(params,tag='',expr=0):
expr
=
VSEval
.
Eval
(
name
,
__mul__
=
VSEval
.
careful_mul
,
__getattr__
=
None
)
return
name
,
expr
raise
ParseError
,
'No name given'
raise
ParseError
,
(
'No name given'
,
tag
)
def
parse_params
(
text
,
result
=
None
,
tag
=
''
,
unparmre
=
regex
.
compile
(
'
\
([
\
0- ]*
\
([^
\
0- =
\
"
]+
\
)
\
)'
),
parmre
=
regex
.
compile
(
...
...
@@ -150,8 +151,8 @@ def parse_params(text,
if result.has_key(''):
if parms.has_key(name): result[name]=parms[name]
else: raise ParseError, (
'
Invalid
parameter
name
,
%
s
<
!
--%
s
-->
<
!
--
u
-->
'
% (name, text)
)
(
'
Invalid
parameter
name
,
%
s
<
!
--%
s
-->
<
!
--
u
-->
'
% (name, text)), tag
)
else:
result['']=name
return apply(parse_params,(text[l:],result),parms)
...
...
@@ -160,7 +161,8 @@ def parse_params(text,
raise InvalidParameter, text
if not parms.has_key(name):
raise ParseError, '
Invalid
parameter
name
,
%
s
<
!
--%
s
-->
' % (name, text)
raise ParseError, (
('
Invalid
parameter
name
,
%
s
<
!
--%
s
-->
' % (name, text)), tag)
result[name]=value
...
...
@@ -173,6 +175,9 @@ except: from pDocumentTemplate import InstanceDict, TemplateDict, render_blocks
############################################################################
# $Log: DT_Util.py,v $
# Revision 1.4 1997/09/25 18:56:39 jim
# fixed problem in reporting errors
#
# Revision 1.3 1997/09/22 14:42:50 jim
# added expr
#
...
...
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