Commit a9ffc1b5 authored by Jim Fulton's avatar Jim Fulton

Added "builtin" 'attr' function: attr(inst,name,_vars)

parent c32aa00c
'''$Id: DT_Util.py,v 1.23 1998/03/04 18:18:40 jim Exp $''' '''$Id: DT_Util.py,v 1.24 1998/03/06 23:22:36 jim Exp $'''
############################################################################ ############################################################################
# Copyright # Copyright
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
# (540) 371-6909 # (540) 371-6909
# #
############################################################################ ############################################################################
__version__='$Revision: 1.23 $'[11:-2] __version__='$Revision: 1.24 $'[11:-2]
import sys, regex, string, types, math, os import sys, regex, string, types, math, os
from string import rfind, strip, joinfields, atoi,lower,upper,capitalize from string import rfind, strip, joinfields, atoi,lower,upper,capitalize
...@@ -142,6 +142,11 @@ def test(*args): ...@@ -142,6 +142,11 @@ def test(*args):
d['test']=test d['test']=test
def _attr(inst, name, md={}):
return careful_getattr(md, inst, name)
d['attr']=_attr
expr_globals={ expr_globals={
'__builtins__':{}, '__builtins__':{},
'_': expr_globals, '_': expr_globals,
...@@ -307,6 +312,9 @@ except: from pDocumentTemplate import InstanceDict, TemplateDict, render_blocks ...@@ -307,6 +312,9 @@ except: from pDocumentTemplate import InstanceDict, TemplateDict, render_blocks
############################################################################ ############################################################################
# $Log: DT_Util.py,v $ # $Log: DT_Util.py,v $
# Revision 1.24 1998/03/06 23:22:36 jim
# Added "builtin" 'attr' function: attr(inst,name,_vars)
#
# Revision 1.23 1998/03/04 18:18:40 jim # Revision 1.23 1998/03/04 18:18:40 jim
# Extended the parse_name utility to handle other name-like tags. # Extended the parse_name utility to handle other name-like tags.
# #
......
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