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
cd7768e8
Commit
cd7768e8
authored
Nov 07, 1997
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed so exception is raised if a sequence cannot be gotten during
rendering.
parent
f62fb973
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
11 deletions
+23
-11
lib/python/DocumentTemplate/DT_If.py
lib/python/DocumentTemplate/DT_If.py
+15
-5
lib/python/DocumentTemplate/DT_In.py
lib/python/DocumentTemplate/DT_In.py
+8
-6
No files found.
lib/python/DocumentTemplate/DT_If.py
View file @
cd7768e8
...
@@ -110,10 +110,11 @@ __doc__='''Conditional insertion
...
@@ -110,10 +110,11 @@ __doc__='''Conditional insertion
# (540) 371-6909
# (540) 371-6909
#
#
############################################################################
############################################################################
__rcs_id__
=
'$Id: DT_If.py,v 1.
4 1997/09/25 18:56:38
jim Exp $'
__rcs_id__
=
'$Id: DT_If.py,v 1.
5 1997/11/07 17:08:11
jim Exp $'
__version__
=
'$Revision: 1.
4
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
5
$'
[
11
:
-
2
]
from
DT_Util
import
*
from
DT_Util
import
*
import
sys
class
If
:
class
If
:
blockContinuations
=
'else'
,
'elif'
blockContinuations
=
'else'
,
'elif'
...
@@ -151,7 +152,9 @@ class If:
...
@@ -151,7 +152,9 @@ class If:
for
name
,
expr
,
section
in
self
.
sections
:
for
name
,
expr
,
section
in
self
.
sections
:
if
expr
is
None
:
if
expr
is
None
:
try
:
v
=
md
[
name
]
try
:
v
=
md
[
name
]
except
:
v
=
None
except
KeyError
,
ev
:
if
ev
is
not
name
:
raise
KeyError
,
name
,
sys
.
exc_traceback
v
=
None
else
:
else
:
v
=
expr
.
eval
(
md
)
v
=
expr
.
eval
(
md
)
...
@@ -175,8 +178,11 @@ class Else:
...
@@ -175,8 +178,11 @@ class Else:
self
.
section
=
section
self
.
section
=
section
def
render
(
self
,
md
):
def
render
(
self
,
md
):
try
:
v
=
md
[
self
.
__name__
]
name
=
self
.
__name__
except
:
v
=
None
try
:
v
=
md
[
name
]
except
KeyError
,
ev
:
if
ev
is
not
name
:
raise
KeyError
,
name
,
sys
.
exc_traceback
v
=
None
if
not
v
:
return
self
.
section
(
None
,
md
)
if
not
v
:
return
self
.
section
(
None
,
md
)
return
''
return
''
...
@@ -185,6 +191,10 @@ class Else:
...
@@ -185,6 +191,10 @@ class Else:
##########################################################################
##########################################################################
#
#
# $Log: DT_If.py,v $
# $Log: DT_If.py,v $
# Revision 1.5 1997/11/07 17:08:11 jim
# Changed so exception is raised if a sequence cannot be gotten during
# rendering.
#
# Revision 1.4 1997/09/25 18:56:38 jim
# Revision 1.4 1997/09/25 18:56:38 jim
# fixed problem in reporting errors
# fixed problem in reporting errors
#
#
...
...
lib/python/DocumentTemplate/DT_In.py
View file @
cd7768e8
...
@@ -228,9 +228,9 @@
...
@@ -228,9 +228,9 @@
Missing values are either 'None' or the attribute 'Value'
Missing values are either 'None' or the attribute 'Value'
of the module 'Missing', if present.
of the module 'Missing', if present.
'''
'''
#'
__rcs_id__
=
'$Id: DT_In.py,v 1.
8 1997/10/28 16:33:49 paul
Exp $'
__rcs_id__
=
'$Id: DT_In.py,v 1.
9 1997/11/07 17:08:33 jim
Exp $'
############################################################################
############################################################################
# Copyright
# Copyright
...
@@ -284,7 +284,7 @@ __rcs_id__='$Id: DT_In.py,v 1.8 1997/10/28 16:33:49 paul Exp $'
...
@@ -284,7 +284,7 @@ __rcs_id__='$Id: DT_In.py,v 1.8 1997/10/28 16:33:49 paul Exp $'
# (540) 371-6909
# (540) 371-6909
#
#
############################################################################
############################################################################
__version__
=
'$Revision: 1.
8
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
9
$'
[
11
:
-
2
]
from
DT_Util
import
*
from
DT_Util
import
*
from
string
import
find
,
atoi
,
join
from
string
import
find
,
atoi
,
join
...
@@ -332,9 +332,7 @@ class In:
...
@@ -332,9 +332,7 @@ class In:
def render(self, md):
def render(self, md):
expr=self.expr
expr=self.expr
if expr is None:
if expr is None: sequence=md[self.__name__]
try: sequence=md[self.__name__] or None
except: sequence=None
else: sequence=expr.eval(md)
else: sequence=expr.eval(md)
if not sequence:
if not sequence:
...
@@ -790,6 +788,10 @@ class sequence_variables:
...
@@ -790,6 +788,10 @@ class sequence_variables:
############################################################################
############################################################################
# $Log: DT_In.py,v $
# $Log: DT_In.py,v $
# Revision 1.9 1997/11/07 17:08:33 jim
# Changed so exception is raised if a sequence cannot be gotten during
# rendering.
#
# Revision 1.8 1997/10/28 16:33:49 paul
# Revision 1.8 1997/10/28 16:33:49 paul
# Small change to docstring.
# Small change to docstring.
#
#
...
...
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