Commit b1fafff4 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Get tools from a portal.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30619 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c59ad072
......@@ -1922,7 +1922,7 @@ class Base( CopyContainer,
"""
Returns the url of an object relative to the portal site.
"""
return self.portal_url.getRelativeUrl(self)
return self.getPortalObject().portal_url.getRelativeUrl(self)
security.declareProtected(Permissions.AccessContentsInformation,
'getAbsoluteUrl')
......@@ -3212,7 +3212,7 @@ class Base( CopyContainer,
Returns the creation date of the document based on workflow information
"""
# Check if edit_workflow defined
portal_workflow = getToolByName(self, 'portal_workflow')
portal_workflow = getToolByName(self.getPortalObject(), 'portal_workflow')
wf = portal_workflow.getWorkflowById('edit_workflow')
wf_list = list(portal_workflow.getWorkflowsFor(self))
if wf is not None: wf_list = [wf] + wf_list
......@@ -3238,7 +3238,7 @@ class Base( CopyContainer,
variable on the workflow which is an alias to time.
"""
# Check if edit_workflow defined
portal_workflow = getToolByName(self, 'portal_workflow')
portal_workflow = getToolByName(self.getPortalObject(), 'portal_workflow')
wf = portal_workflow.getWorkflowById('edit_workflow')
wf_list = list(portal_workflow.getWorkflowsFor(self))
if wf is not None:
......
......@@ -72,7 +72,7 @@ class CopyContainer:
ids=[uids]
oblist=[]
for uid in uids:
ob=self.portal_catalog.getObject(uid)
ob=self.getPortalObject().portal_catalog.getObject(uid)
if not ob.cb_isCopyable():
raise CopyError, eNotSupported % uid
m=Moniker.Moniker(ob)
......@@ -187,7 +187,7 @@ class CopyContainer:
ids=[uids]
oblist=[]
for uid in uids:
ob=self.portal_catalog.getObject(uid)
ob=self.getPortalObject().portal_catalog.getObject(uid)
if not ob.cb_isMoveable():
raise CopyError, eNotSupported % id
m=Moniker.Moniker(ob)
......@@ -221,7 +221,7 @@ class CopyContainer:
action ='./manage_main',)
while uids:
uid=uids[-1]
ob=self.portal_catalog.getObject(uid)
ob=self.getPortalObject().portal_catalog.getObject(uid)
container = ob.aq_inner.aq_parent
id = ob.id
v=container._getOb(id, self)
......@@ -243,7 +243,7 @@ class CopyContainer:
self_base = aq_base(self)
#LOG("After Clone ",0, "self:%s item:%s" % (repr(self), repr(item)))
#LOG("After Clone ",0, "self:%s item:%s" % (repr(self), repr(self.getPortalObject().objectIds())))
portal_catalog = getToolByName(self, 'portal_catalog')
portal_catalog = getToolByName(self.getPortalObject(), 'portal_catalog')
self_base.uid = portal_catalog.newUid()
# Give the Owner local role to the current user, zope only does this if no
......@@ -348,7 +348,7 @@ class CopyContainer:
Unindex the object from the portal catalog.
"""
if self.isIndexable:
catalog = getToolByName(self, 'portal_catalog', None)
catalog = getToolByName(self.getPortalObject(), 'portal_catalog', None)
if catalog is not None:
# Make sure there is not activity for this object
self.flushActivity(invoke=0)
......@@ -388,7 +388,7 @@ class CopyContainer:
# Update the modification date.
if getattr(aq_base(self), 'notifyModified', _marker) is not _marker:
self.notifyModified()
catalog = getToolByName(self, 'portal_catalog', None)
catalog = getToolByName(self.getPortalObject(), 'portal_catalog', None)
if catalog is not None:
catalog.moveObject(self, idxs=idxs)
......@@ -499,7 +499,7 @@ class CopyContainer:
def _postDuplicate(self):
self_base = aq_base(self)
portal_catalog = getToolByName(self, 'portal_catalog')
portal_catalog = getToolByName(self.getPortalObject(), 'portal_catalog')
self_base.uid = portal_catalog.newUid()
# Give the Owner local role to the current user, zope only does this if no
......
......@@ -370,7 +370,7 @@ class ERP5TypeInformation(XMLObject,
# notify workflow after generating local roles, in order to prevent
# Unauthorized error on transition's condition
workflow_tool = getToolByName(self, 'portal_workflow', None)
workflow_tool = getToolByName(self.getPortalObject(), 'portal_workflow', None)
if workflow_tool is not None:
for workflow in workflow_tool.getWorkflowsFor(ob):
workflow.notifyCreated(ob)
......
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