Commit 42a2daa4 authored by Jim Fulton's avatar Jim Fulton

Added __bobo_traverse__ machinery in support of sessions.

Updated product installation logic to give OFS special treatment.
parent 015a60d9
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
__doc__='''Application support __doc__='''Application support
$Id: Application.py,v 1.17 1997/11/06 22:43:39 brian Exp $''' $Id: Application.py,v 1.18 1997/11/07 16:09:59 jim Exp $'''
__version__='$Revision: 1.17 $'[11:-2] __version__='$Revision: 1.18 $'[11:-2]
import Globals,Folder,regex import Globals,Folder,regex
...@@ -20,7 +20,6 @@ from string import lower, find ...@@ -20,7 +20,6 @@ from string import lower, find
from AccessControl.User import UserFolder from AccessControl.User import UserFolder
from DateTime import DateTime from DateTime import DateTime
class Application(Folder.Folder): class Application(Folder.Folder):
title ='Principia' title ='Principia'
id =title id =title
...@@ -65,12 +64,28 @@ class Application(Folder.Folder): ...@@ -65,12 +64,28 @@ class Application(Folder.Folder):
def __class_init__(self): pass def __class_init__(self): pass
def PrincipiaRedirect(self,destination,PARENT_URL): def PrincipiaRedirect(self,destination,URL1):
"""Utility function to allow user-controlled redirects""" """Utility function to allow user-controlled redirects"""
if find(destination,'//') >= 0: raise 'Redirect', destination if find(destination,'//') >= 0: raise 'Redirect', destination
raise 'Redirect', ("%s/%s" % (PARENT_URL, destination)) raise 'Redirect', ("%s/%s" % (URL1, destination))
Redirect=PrincipiaRedirect Redirect=PrincipiaRedirect
def __bobo_traverse__(self, REQUEST, name=None):
if name is None and REQUEST.has_key(Globals.SessionNameName):
pd=Globals.SessionBase[REQUEST[Globals.SessionNameName]]
alternate_self=pd.jar[self._p_oid]
if hasattr(self, 'aq_parent'):
alternate_self=alternate_self.__of__(self.aq_parent)
return alternate_self
try: return getattr(self, name)
except AttributeError:
try: return self[name]
except KeyError:
raise 'NotFound',(
"Sorry, the requested document does not exist.<p>"
"\n<!--\n%s\n%s\n-->" % (name,REQUEST['REQUEST_METHOD']))
def PrincipiaTime(self): def PrincipiaTime(self):
"""Utility function to return current date/time""" """Utility function to return current date/time"""
return DateTime() return DateTime()
...@@ -102,10 +117,11 @@ def install_products(products): ...@@ -102,10 +117,11 @@ def install_products(products):
meta_types=list(Folder.Folder.dynamic_meta_types) meta_types=list(Folder.Folder.dynamic_meta_types)
role_names=list(app.__defined_roles__) role_names=list(app.__defined_roles__)
for product in products: for product_name in products:
product=__import__(product) product=__import__(product_name)
for meta_type in product.meta_types: for meta_type in product.meta_types:
meta_types.append(meta_type) if product_name=='OFS': meta_types.insert(0,meta_type)
else: meta_types.append(meta_type)
name=meta_type['name'] name=meta_type['name']
if (not meta_type.has_key('prefix') and if (not meta_type.has_key('prefix') and
...@@ -180,6 +196,10 @@ if __name__ == "__main__": main() ...@@ -180,6 +196,10 @@ if __name__ == "__main__": main()
############################################################################## ##############################################################################
# #
# $Log: Application.py,v $ # $Log: Application.py,v $
# Revision 1.18 1997/11/07 16:09:59 jim
# Added __bobo_traverse__ machinery in support of sessions.
# Updated product installation logic to give OFS special treatment.
#
# Revision 1.17 1997/11/06 22:43:39 brian # Revision 1.17 1997/11/06 22:43:39 brian
# Added global roles to app # Added global roles to app
# #
......
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