Commit 3f433001 authored by Jim Fulton's avatar Jim Fulton

Changed HTML file to support passing in globals()

parent 2eb7ce11
"""Global definitions""" """Global definitions"""
__version__='$Revision: 1.9 $'[11:-2] __version__='$Revision: 1.10 $'[11:-2]
import sys, os
from string import atof, rfind
try: try:
home=CUSTOMER_HOME,SOFTWARE_HOME,SOFTWARE_URL home=CUSTOMER_HOME,SOFTWARE_HOME,SOFTWARE_URL
CUSTOMER_HOME,SOFTWARE_HOME,SOFTWARE_URL=home CUSTOMER_HOME,SOFTWARE_HOME,SOFTWARE_URL=home
except: except:
# Debugger support # Debugger support
import sys, os
try: home=os.environ['SOFTWARE_HOME'] try: home=os.environ['SOFTWARE_HOME']
except: except:
home=os.getcwd() home=os.getcwd()
...@@ -21,7 +22,6 @@ except: ...@@ -21,7 +22,6 @@ except:
from SingleThreadedTransaction import PickleDictionary, Persistent from SingleThreadedTransaction import PickleDictionary, Persistent
from SingleThreadedTransaction import PersistentMapping
import DocumentTemplate import DocumentTemplate
class HTML(DocumentTemplate.HTML,Persistent,): class HTML(DocumentTemplate.HTML,Persistent,):
...@@ -33,8 +33,11 @@ class HTMLDefault(DocumentTemplate.HTMLDefault,Persistent,): ...@@ -33,8 +33,11 @@ class HTMLDefault(DocumentTemplate.HTMLDefault,Persistent,):
class HTMLFile(DocumentTemplate.HTMLFile,Persistent,): class HTMLFile(DocumentTemplate.HTMLFile,Persistent,):
"Persistent HTML Document Templates read from files" "Persistent HTML Document Templates read from files"
def __init__(self,name='',*args,**kw): def __init__(self,name,_prefix=None, **kw):
args=(self, '%s/lib/python/%s.dtml' % (SOFTWARE_HOME,name),) + args if _prefix is None: _prefix=SOFTWARE_HOME+'/lib/python'
elif type(_prefix) is not type(''): _prefix=package_home(_prefix)
args=(self, '%s/%s.dtml' % (_prefix,name))
apply(HTMLFile.inheritedAttribute('__init__'),args,kw) apply(HTMLFile.inheritedAttribute('__init__'),args,kw)
data_dir = CUSTOMER_HOME+'/var' data_dir = CUSTOMER_HOME+'/var'
...@@ -46,12 +49,24 @@ from App.Dialogs import MessageDialog ...@@ -46,12 +49,24 @@ from App.Dialogs import MessageDialog
SessionNameName='Principia-Session' SessionNameName='Principia-Session'
if atof(sys.version[:3]) >= 1.5:
def package_home(globals_dict):
__name__=globals_dict['__name__']
return sys.modules[__name__[:rfind(__name__,'.')]].__path__[0]
else:
# ni
def package_home(globals_dict):
return globals_dict['__'].__path__[0]
########################################################################## ##########################################################################
# #
# Log # Log
# #
# $Log: Globals.py,v $ # $Log: Globals.py,v $
# Revision 1.10 1997/12/17 16:36:50 jim
# Changed HTML file to support passing in globals()
#
# Revision 1.9 1997/11/21 19:33:45 brian # Revision 1.9 1997/11/21 19:33:45 brian
# Fixed out-of-date debugger support to add correct SH, CH, SU # Fixed out-of-date debugger support to add correct SH, CH, SU
# #
......
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