Commit 1ba993f8 authored by Jérome Perrin's avatar Jérome Perrin

add a getAbsoluteUrl method to be able to use it in property sheets


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20702 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 25792737
......@@ -1820,6 +1820,14 @@ class Base( CopyContainer,
"""
return self.portal_url.getRelativeUrl(self)
security.declareProtected(Permissions.AccessContentsInformation,
'getAbsoluteUrl')
def getAbsoluteUrl(self):
"""
Returns the absolute url of an object.
"""
return self.absolute_url()
security.declareProtected(Permissions.AccessContentsInformation, 'getPortalObject')
def getPortalObject(self):
"""
......
  • @jerome , interesting, I found this method by chance and I am not sure it is really used (grepping shows being called 17 times in ERP5 code).

    Are there reasons to use this over absolute_url (I cannot understand the property sheets need), apart from the fact that it looks more ERP5?

  • I will dig git history to try to remember why I did this... my guess is that it looks more ERP5 naming. Or maybe it is here so that we can do getDefaultImageAbsoluteUrl ?

    That's a fact that absolute_url looks a bit "exceptional" naming. There are a few other places where we use zope names directly.

  • also permission is different from the original view, but I think it's accidental. Anyway, there should not be much cases where we need to show URLs to documents users cannot view

  • @georgios.dagkakis , yes, it was to enable getDefaultImageAbsoluteUrl, that exists for example on products. ( 5ec6112c )

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