Commit b642c62a authored by Vincent Pelletier's avatar Vincent Pelletier

Move newTempDocumentationHelper and TempDocumentationHelper to...

Move newTempDocumentationHelper and TempDocumentationHelper to ERP5Type/Base.py. This class have not to be protected by class tool protection, since it is just a container. The right function to secure is asDocumentationHelper because it's the function which might gather sensible information from documents, and which requires ManagePortal role.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@9340 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent cb6a0e53
...@@ -117,7 +117,6 @@ class WorkflowMethod(Method): ...@@ -117,7 +117,6 @@ class WorkflowMethod(Method):
(instance,) + args, kw) (instance,) + args, kw)
return res return res
def _aq_reset(): def _aq_reset():
Base.aq_method_generated = {} Base.aq_method_generated = {}
Base.aq_portal_type = {} Base.aq_portal_type = {}
...@@ -2338,8 +2337,6 @@ class Base( CopyContainer, PortalContent, ActiveObject, ERP5PropertyManager ): ...@@ -2338,8 +2337,6 @@ class Base( CopyContainer, PortalContent, ActiveObject, ERP5PropertyManager ):
PortalType, and are browsed a second time to be able to group them PortalType, and are browsed a second time to be able to group them
by property or category. by property or category.
""" """
from Products.ERP5Type.Tool.ClassTool import newTempDocumentationHelper
if item_id is None: if item_id is None:
documented_item = self documented_item = self
item_id = documented_item.getTitle() item_id = documented_item.getTitle()
...@@ -2597,3 +2594,39 @@ class TempBase(Base): ...@@ -2597,3 +2594,39 @@ class TempBase(Base):
return getattr(self,'title',None) return getattr(self,'title',None)
security.declarePublic('setProperty') security.declarePublic('setProperty')
def newTempDocumentationHelper(folder, id, REQUEST=None, **kw):
o = TempDocumentationHelper(id)
o = o.__of__(folder)
if kw is not None:
o._edit(force_update=1, **kw)
return o
class TempDocumentationHelper(TempBase):
"""
Contains information about a documentable item.
Documentable item can be any python type, instanciated or not.
"""
meta_type = "ERP5 Documentation Helper"
portal_type = "Documentation Helper"
property_sheets = ( PropertySheet.Base
, PropertySheet.DublinCore
, PropertySheet.DocumentationHelper
, )
def _funcname_cmp_prepare(self, funcname):
for pos in range(len(funcname)):
if funcname[pos] != '_':
break
return '%s%s' % (funcname[pos:], funcname[:pos])
def __cmp__(self, documentationhelper):
my_title = self._funcname_cmp_prepare(self.getTitle())
his_title = self._funcname_cmp_prepare(documentationhelper.getTitle())
if my_title < his_title:
return -1
if my_title > his_title:
return 1
return 0
...@@ -808,45 +808,6 @@ def initialize( context ): ...@@ -808,45 +808,6 @@ def initialize( context ):
dochelper.setStaticPropertyList(property_list) dochelper.setStaticPropertyList(property_list)
return dochelper return dochelper
from Products.ERP5Type.Base import TempBase
from Products.ERP5Type import PropertySheet
def newTempDocumentationHelper(folder, id, REQUEST=None, **kw):
o = TempDocumentationHelper(id)
o = o.__of__(folder)
if kw is not None:
o._edit(force_update=1, **kw)
return o
class TempDocumentationHelper(TempBase):
"""
Contains information about a documentable item.
Documentable item can be any python type, instanciated or not.
"""
meta_type = "ERP5 Documentation Helper"
portal_type = "Documentation Helper"
property_sheets = ( PropertySheet.Base
, PropertySheet.DublinCore
, PropertySheet.DocumentationHelper
, )
def _funcname_cmp_prepare(self, funcname):
for pos in range(len(funcname)):
if funcname[pos] != '_':
break
return '%s%s' % (funcname[pos:], funcname[:pos])
def __cmp__(self, documentationhelper):
my_title = self._funcname_cmp_prepare(self.getTitle())
his_title = self._funcname_cmp_prepare(documentationhelper.getTitle())
if my_title < his_title:
return -1
if my_title > his_title:
return 1
return 0
else: else:
class ClassTool(BaseTool): class ClassTool(BaseTool):
......
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