Commit 351434ef authored by Hanno Schlichting's avatar Hanno Schlichting

Use even more proper aq_* method calls

parent 39105ee6
......@@ -22,6 +22,7 @@ from AccessControl import ClassSecurityInfo
from AccessControl.DTML import RestrictedDTML
from AccessControl.Permission import name_trans
from AccessControl.Permissions import view_management_screens
from Acquisition import aq_base
from DateTime import DateTime
from DocumentTemplate.DT_Util import Eval
from DocumentTemplate.DT_Util import InstanceDict, TemplateDict
......@@ -92,9 +93,8 @@ class FindSupport(ExtensionClass.Base):
md=td()
obj_expr=(Eval(obj_expr), md, md._push, md._pop)
base=obj
if hasattr(obj, 'aq_base'):
base=obj.aq_base
base = obj
base = aq_base(obj)
if hasattr(base, 'objectItems'):
try: items=obj.objectItems()
......@@ -118,9 +118,7 @@ class FindSupport(ExtensionClass.Base):
if hasattr(ob, '_p_changed') and (ob._p_changed == None):
dflag=1
if hasattr(ob, 'aq_base'):
bs=ob.aq_base
else: bs=ob
bs = aq_base(ob)
if (
(not obj_ids or absattr(bs.getId()) in obj_ids)
and
......@@ -200,9 +198,8 @@ class FindSupport(ExtensionClass.Base):
md=td()
obj_expr=(Eval(obj_expr), md, md._push, md._pop)
base=obj
if hasattr(obj, 'aq_base'):
base=obj.aq_base
base = obj
base = aq_base(obj)
if not hasattr(base, 'objectItems'):
return result
......@@ -221,10 +218,7 @@ class FindSupport(ExtensionClass.Base):
if hasattr(ob, '_p_changed') and (ob._p_changed == None):
dflag=1
if hasattr(ob, 'aq_base'):
bs=ob.aq_base
else: bs=ob
bs = aq_base(ob)
if (
(not obj_ids or absattr(bs.getId()) in obj_ids)
and
......
......@@ -20,13 +20,14 @@ from webdav.WriteLockInterface import WriteLockInterface
from ZPublisher.Converters import type_converters
from Globals import InitializeClass
from Globals import DTMLFile, MessageDialog
from Acquisition import aq_base
from Acquisition import aq_parent
from Acquisition import Implicit, Explicit
from App.Common import rfc1123_date, iso8601_date
from webdav.common import urlbase
from ExtensionClass import Base
from Globals import Persistent
from Traversable import Traversable
from Acquisition import aq_base
from AccessControl import ClassSecurityInfo
from AccessControl.Permissions import access_contents_information
from AccessControl.Permissions import manage_properties
......@@ -71,7 +72,7 @@ class View(App.Management.Tabs, Base):
pre=pre+'/'
r=[]
for d in self.aq_parent.aq_parent.manage_options:
for d in aq_parent(aq_parent(self)).manage_options:
path=d['action']
option={'label': d['label'],
'action': pre+path,
......@@ -92,7 +93,7 @@ class View(App.Management.Tabs, Base):
self, script, path)
def meta_type(self):
try: return self.aq_parent.aq_parent.meta_type
try: return aq_parent(aq_parent(self)).meta_type
except: return ''
......@@ -489,7 +490,7 @@ class Virtual:
pass
def v_self(self):
return self.aq_parent.aq_parent
return aq_parent(aq_parent(self))
class DefaultProperties(Virtual, PropertySheet, View):
......@@ -635,7 +636,7 @@ class PropertySheets(Traversable, Implicit, App.Management.Tabs):
return (self.webdav,)
def __propsets__(self):
propsets=self.aq_parent.__propsets__
propsets = aq_parent(self).__propsets__
__traceback_info__= propsets, type(propsets)
return self._get_defaults() + propsets
......@@ -684,17 +685,17 @@ class PropertySheets(Traversable, Implicit, App.Management.Tabs):
security.declareProtected(manage_properties, 'addPropertySheet')
def addPropertySheet(self, propset):
propsets=self.aq_parent.__propsets__
propsets=propsets+(propset,)
self.aq_parent.__propsets__=propsets
propsets = aq_parent(self).__propsets__
propsets = propsets+(propset,)
aq_parent(self).__propsets__ = propsets
security.declareProtected(manage_properties, 'delPropertySheet')
def delPropertySheet(self, name):
result=[]
for propset in self.aq_parent.__propsets__:
for propset in aq_parent(self).__propsets__:
if propset.getId() != name and propset.xml_namespace() != name:
result.append(propset)
self.aq_parent.__propsets__=tuple(result)
aq_parent(self).__propsets__=tuple(result)
## DM: deletion support
def isDeletable(self,name):
......@@ -743,7 +744,7 @@ class PropertySheets(Traversable, Implicit, App.Management.Tabs):
pre=pre+'/'
r=[]
for d in self.aq_parent.manage_options:
for d in aq_parent(self).manage_options:
r.append({'label': d['label'], 'action': pre+d['action']})
return r
......
......@@ -205,14 +205,16 @@ class Item(Base, Resource, CopySource, App.Management.Tabs, Traversable,
if match is not None:
error_message=error_value
if client is None: client=self
if not REQUEST: REQUEST=self.aq_acquire('REQUEST')
if client is None:
client = self
if not REQUEST:
REQUEST = aq_acquire(self, 'REQUEST')
try:
if hasattr(client, 'standard_error_message'):
s=getattr(client, 'standard_error_message')
else:
client = client.aq_parent
client = aq_parent(client)
s=getattr(client, 'standard_error_message')
kwargs = {'error_type': error_type,
'error_value': error_value,
......@@ -329,7 +331,7 @@ class Item(Base, Resource, CopySource, App.Management.Tabs, Traversable,
raise ValueError('FTP List not supported on acquired objects')
if not hasattr(ob,'aq_parent'):
break
ob=ob.aq_parent
ob = aq_parent(ob)
stat=marshal.loads(self.manage_FTPstat(REQUEST))
id = self.getId()
......
......@@ -16,6 +16,8 @@ DOM implementation in ZOPE : Read-Only methods
All standard Zope objects support DOM to a limited extent.
"""
import Acquisition
from Acquisition import aq_base
from Acquisition import aq_parent
from Globals import InitializeClass
from AccessControl import ClassSecurityInfo
from AccessControl.Permissions import access_contents_information
......@@ -149,7 +151,7 @@ class Node:
When this is a document this is None"""
node = self
if hasattr(node, 'aq_parent'):
node = self.aq_parent
node = aq_parent(self)
return node.getOwnerDocument()
return node
......@@ -198,7 +200,7 @@ class Document(Acquisition.Explicit, Node):
This is a convenience attribute that allows direct access to
the child node that is the root element of the document.
"""
return self.aq_parent
return aq_parent(self)
# Node Methods
# ------------
......@@ -219,17 +221,17 @@ class Document(Acquisition.Explicit, Node):
def getChildNodes(self):
"""Returns a NodeList that contains all children of this node.
If there are no children, this is a empty NodeList"""
return NodeList([self.aq_parent])
return NodeList([aq_parent(self)])
def getFirstChild(self):
"""The first child of this node. If there is no such node
this returns None."""
return self.aq_parent
return aq_parent(self)
def getLastChild(self):
"""The last child of this node. If there is no such node
this returns None."""
return self.aq_parent
return aq_parent(self)
def hasChildNodes(self):
"""Returns true if the node has any children, false
......@@ -324,7 +326,7 @@ class Element(Node):
"""The node immediately preceding this node. If
there is no such node, this returns None."""
if hasattr(self, 'aq_parent'):
parent = self.aq_parent
parent = aq_parent(self)
ids=list(parent.objectIds())
id=self.id
if type(id) is not type(''): id=id()
......@@ -338,7 +340,7 @@ class Element(Node):
"""The node immediately preceding this node. If
there is no such node, this returns None."""
if hasattr(self, 'aq_parent'):
parent = self.aq_parent
parent = aq_parent(self)
ids=list(parent.objectIds())
id=self.id
if type(id) is not type(''): id=id()
......@@ -432,7 +434,7 @@ class ElementWithTitle(Element):
def getAttribute(self, name):
"""Retrieves an attribute value by name."""
if name=='title' and hasattr(self.aq_base, 'title'):
if name=='title' and hasattr(aq_base(self), 'title'):
return self.title
return ''
......
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