Commit 2e8e2db9 authored by Shane Hathaway's avatar Shane Hathaway

After demonstrating the correctness of the original class_init, put things

back in order.  The change to Management.py demonstrates the proper
way to fix the bug that today's patches were trying to address.
parent 61cdb4ac
...@@ -85,9 +85,9 @@ ...@@ -85,9 +85,9 @@
"""Standard management interface support """Standard management interface support
$Id: Management.py,v 1.44 2001/01/15 21:12:41 brian Exp $""" $Id: Management.py,v 1.45 2001/01/16 02:55:10 shane Exp $"""
__version__='$Revision: 1.44 $'[11:-2] __version__='$Revision: 1.45 $'[11:-2]
import sys, Globals, ExtensionClass, urllib import sys, Globals, ExtensionClass, urllib
from Dialogs import MessageDialog from Dialogs import MessageDialog
...@@ -223,7 +223,7 @@ class Navigation(ExtensionClass.Base): ...@@ -223,7 +223,7 @@ class Navigation(ExtensionClass.Base):
manage_form_title.__roles__ = None manage_form_title.__roles__ = None
zope_quick_start=DTMLFile('dtml/zope_quick_start', globals()) zope_quick_start=DTMLFile('dtml/zope_quick_start', globals())
zope_quick_start__roles__=None zope_quick_start.__roles__=None
manage_copyright=DTMLFile('dtml/copyright', globals()) manage_copyright=DTMLFile('dtml/copyright', globals())
manage_copyright.__roles__ = None manage_copyright.__roles__ = None
......
...@@ -100,12 +100,18 @@ def default__class_init__(self): ...@@ -100,12 +100,18 @@ def default__class_init__(self):
for name, v in dict_items: for name, v in dict_items:
if hasattr(v,'_need__name__') and v._need__name__: if hasattr(v,'_need__name__') and v._need__name__:
v.__dict__['__name__']=name v.__dict__['__name__']=name
if name=='manage' or name[:7]=='manage_': if name=='manage' or name[:7]=='manage_':
name=name+'__roles__' if not hasattr(v, '__roles__'):
if not have(name): dict[name]='Manager', try:
elif name=='manage' or name[:7]=='manage_' and type(v) is ft: v.__roles__ = ('Manager',)
name=name+'__roles__' except:
if not have(name): dict[name]='Manager', # This attribute can't hold a __roles__
# attribute. Try to store __roles__ in the
# class instead.
nr = name + '__roles__'
if not have(nr):
try: dict[nr] = ('Manager',)
except: pass
# Look for a SecurityInfo object on the class. If found, call its # Look for a SecurityInfo object on the class. If found, call its
# apply() method to generate __ac_permissions__ for the class. We # apply() method to generate __ac_permissions__ for the class. We
......
...@@ -137,23 +137,14 @@ from Acquisition import Explicit ...@@ -137,23 +137,14 @@ from Acquisition import Explicit
from DocumentTemplate.DT_String import _marker, DTReturn, render_blocks from DocumentTemplate.DT_String import _marker, DTReturn, render_blocks
from DocumentTemplate.DT_Util import TemplateDict, InstanceDict from DocumentTemplate.DT_Util import TemplateDict, InstanceDict
from AccessControl import getSecurityManager from AccessControl import getSecurityManager
from ComputedAttribute import ComputedAttribute
class DTMLFile(Bindings, Explicit, ClassicHTMLFile): class DTMLFile(Bindings, Explicit, ClassicHTMLFile):
"HTMLFile with bindings and support for __render_with_namespace__" "HTMLFile with bindings and support for __render_with_namespace__"
func_code = None func_code = None
func_defaults = None func_defaults = None
_need__name__=1
_Bindings_ns_class = TemplateDict _Bindings_ns_class = TemplateDict
def _get__roles__(self):
imp = getattr(self.aq_inner.aq_parent, '%s__roles__' % self.__name__)
if hasattr(imp, '__of__'):
return imp.__of__(self)
return imp
__roles__ = ComputedAttribute(_get__roles__, 1)
# By default, we want to look up names in our container. # By default, we want to look up names in our container.
_Bindings_client = 'container' _Bindings_client = 'container'
......
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