Commit 72b16754 authored by Hanno Schlichting's avatar Hanno Schlichting

More proper usage of the aq_* methods

parent e297e2f8
...@@ -17,6 +17,7 @@ $Id$ ...@@ -17,6 +17,7 @@ $Id$
import string, Products, Globals import string, Products, Globals
from Acquisition import aq_base
name_trans=filter(lambda c, an=string.letters+string.digits+'_': c not in an, name_trans=filter(lambda c, an=string.letters+string.digits+'_': c not in an,
map(chr,range(256))) map(chr,range(256)))
...@@ -36,8 +37,7 @@ class Permission: ...@@ -36,8 +37,7 @@ class Permission:
self.name=name self.name=name
self._p='_'+string.translate(name,name_trans)+"_Permission" self._p='_'+string.translate(name,name_trans)+"_Permission"
self.data=data self.data=data
if hasattr(obj, 'aq_base'): obj=obj.aq_base self.obj=aq_base(obj)
self.obj=obj
self.default=default self.default=default
def getRoles(self, default=_marker): def getRoles(self, default=_marker):
......
...@@ -20,6 +20,8 @@ import re ...@@ -20,6 +20,8 @@ import re
import socket import socket
from base64 import decodestring from base64 import decodestring
from Acquisition import aq_base
from Acquisition import aq_parent
from Acquisition import aq_inContextOf from Acquisition import aq_inContextOf
from Acquisition import Implicit from Acquisition import Implicit
from App.Management import Navigation, Tabs from App.Management import Navigation, Tabs
...@@ -152,7 +154,7 @@ class BasicUser(Implicit): ...@@ -152,7 +154,7 @@ class BasicUser(Implicit):
if getattr(parent, '__parent__', None) is not None: if getattr(parent, '__parent__', None) is not None:
while hasattr(parent.aq_self,'aq_self'): while hasattr(parent.aq_self,'aq_self'):
parent = parent.aq_self parent = parent.aq_self
parent = parent.__parent__ parent = aq_parent(parent)
else: return r else: return r
def _check_context(self, object): def _check_context(self, object):
...@@ -772,7 +774,7 @@ class BasicUserFolder(Implicit, Persistent, Navigation, Tabs, RoleManager, ...@@ -772,7 +774,7 @@ class BasicUserFolder(Implicit, Persistent, Navigation, Tabs, RoleManager,
def _isTop(self): def _isTop(self):
try: try:
return self.__parent__.aq_base.isTopLevelPrincipiaApplicationObject return aq_base(aq_parent(self)).isTopLevelPrincipiaApplicationObject
except: except:
return 0 return 0
...@@ -987,8 +989,8 @@ class BasicUserFolder(Implicit, Persistent, Navigation, Tabs, RoleManager, ...@@ -987,8 +989,8 @@ class BasicUserFolder(Implicit, Persistent, Navigation, Tabs, RoleManager,
def manage_afterAdd(self, item, container): def manage_afterAdd(self, item, container):
if item is self: if item is self:
if hasattr(self, 'aq_base'): self=self.aq_base self = aq_base(self)
container.__allow_groups__=self container.__allow_groups__ = self
def __creatable_by_emergency_user__(self): return 1 def __creatable_by_emergency_user__(self): return 1
......
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