Commit 40b51d8d authored by Brian Lloyd's avatar Brian Lloyd

fix builtins

parent c96ba687
......@@ -12,8 +12,8 @@
##############################################################################
'''Add security system support to Document Templates
$Id: DTML.py,v 1.12 2004/01/15 23:09:03 tseaver Exp $'''
__version__='$Revision: 1.12 $'[11:-2]
$Id: DTML.py,v 1.13 2004/01/19 14:49:28 Brian Exp $'''
__version__='$Revision: 1.13 $'[11:-2]
from DocumentTemplate import DT_Util
import SecurityManagement, string, math, whrandom, random
......@@ -98,8 +98,10 @@ for name, v in DTMLSecurityAPI.__dict__.items():
if name[0] != '_':
setattr(DT_Util.TemplateDict, name, v)
from types import FunctionType
for name, v in safe_builtins.items():
v = DT_Util.NotBindable(v)
if type(v) is FunctionType:
v = DT_Util.NotBindable(v)
if name.startswith('__'):
continue
setattr(DT_Util.TemplateDict, name, v)
......@@ -13,8 +13,8 @@
"""Document Template Tests
"""
__rcs_id__='$Id: testSecurity.py,v 1.12 2004/01/16 18:18:51 tseaver Exp $'
__version__='$Revision: 1.12 $'[11:-2]
__rcs_id__='$Id: testSecurity.py,v 1.13 2004/01/19 14:49:29 Brian Exp $'
__version__='$Revision: 1.13 $'[11:-2]
import os, sys, unittest
......@@ -84,10 +84,13 @@ class SecurityTests (DTMLTests):
<dtml-var expr="_.min([1,2])">
<dtml-var expr="_.max([2,3])">
<dtml-var expr="_.sum([1,2,3,4])">
<dtml-var expr="_.hasattr(1, 'foo') and 'Yes' or 'No'">
<dtml-var expr="_.None">
<dtml-var expr="_.string.strip(' testing ')">
<dtml-var expr="[x for x in (1, 2, 3)]">
"""
EXPECTED = ['1', '3', '10', '[1, 2, 3]']
EXPECTED = ['1', '3', '10', 'No', 'None', 'testing', '[1, 2, 3]']
#
# XXX: these expressions seem like they should work, with
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment