Commit 455e7415 authored by Jérome Perrin's avatar Jérome Perrin

ERP5: "quick and dirty" type annotations XXX

IIRC the only thing needed is that ERP5TypeTestCase.getPortal is an
ERP5Site
parent 13481895
......@@ -53,6 +53,11 @@ from Products.ERP5Type.Utils import sortValueList
from Products.ERP5Type import Permissions
from Products.ERP5Type.Globals import InitializeClass
from Products.ERP5Type.Accessor import Base as BaseAccessor
try:
from typing import List
except ImportError:
pass
try:
from Products.CMFCore.CMFBTreeFolder import CMFBTreeFolder
except ImportError:
......@@ -202,6 +207,7 @@ class FolderMixIn(ExtensionClass.Base):
security.declarePublic('newContent')
def newContent(self, id=None, portal_type=None, id_group=None,
default=None, method=None, container=None, temp_object=0, **kw):
# type: (...) -> Folder
"""Creates a new content.
This method is public, since TypeInformation.constructInstance will perform
the security check.
......@@ -417,6 +423,7 @@ class FolderMixIn(ExtensionClass.Base):
# Get the content
security.declareProtected(Permissions.AccessContentsInformation, 'searchFolder')
def searchFolder(self, **kw):
# type: (str) -> List[Folder]
"""
Search the content of a folder by calling
the portal_catalog.
......@@ -1513,6 +1520,7 @@ class Folder(FolderMixIn, CopyContainer, ObjectManager, Base, OFSFolder2, CMFBTr
def objectValues(self, spec=None, meta_type=None, portal_type=None,
sort_on=None, sort_order=None, checked_permission=None,
**kw):
# type: () -> List[Folder]
# Returns list of objects contained in this folder.
# (no docstring to prevent publishing)
if meta_type is not None:
......@@ -1545,6 +1553,7 @@ class Folder(FolderMixIn, CopyContainer, ObjectManager, Base, OFSFolder2, CMFBTr
security.declareProtected( Permissions.AccessContentsInformation,
'contentValues' )
def contentValues(self, *args, **kw):
# type: () -> List[Folder]
# Returns a list of documents contained in this folder.
# ( no docstring to prevent publishing )
portal_type_id_list = self._getTypesTool().listContentTypes()
......
......@@ -214,6 +214,13 @@ def _parse_args(self, *args, **kw):
_parse_args._original = DateTime._original_parse_args
DateTime._parse_args = _parse_args
try:
from erp5.portal_type import ERP5Site as erp5_portal_type_ERP5Site
except ImportError:
pass
class ERP5TypeTestCaseMixin(ProcessingNodeTestCase, PortalTestCase):
"""Mixin class for ERP5 based tests.
"""
......@@ -936,6 +943,7 @@ class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin):
return portal_name + '_' + m.hexdigest()
def getPortal(self):
# type: () -> erp5_portal_type_ERP5Site
"""Returns the portal object, i.e. the "fixture root".
It also does some initialization, as if the portal was accessed for the
......
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