Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Jérome Perrin
erp5
Commits
60e8992e
Commit
60e8992e
authored
Oct 28, 2019
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5: "quick and dirty" type annotations
parent
18e165d6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
0 deletions
+24
-0
product/ERP5Type/Base.py
product/ERP5Type/Base.py
+7
-0
product/ERP5Type/Core/Folder.py
product/ERP5Type/Core/Folder.py
+9
-0
product/ERP5Type/tests/ERP5TypeTestCase.py
product/ERP5Type/tests/ERP5TypeTestCase.py
+8
-0
No files found.
product/ERP5Type/Base.py
View file @
60e8992e
...
...
@@ -1752,6 +1752,7 @@ class Base( CopyContainer,
security
.
declarePublic
(
'getPortalObject'
)
def
getPortalObject
(
self
):
# type: () -> IPortalObject
"""
Returns the portal object
"""
...
...
@@ -3527,3 +3528,9 @@ class TempBase(Base):
# allow_class(TempBase) in ERP5Type/Document/__init__.py will trample our
# ClassSecurityInfo with one that doesn't declare our public methods
InitializeClass
(
TempBase
)
try
:
from
erp5.portal_type
import
IPortalObject
except
ImportError
:
pass
product/ERP5Type/Core/Folder.py
View file @
60e8992e
...
...
@@ -51,6 +51,11 @@ 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
:
...
...
@@ -117,6 +122,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.
...
...
@@ -333,6 +339,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.
...
...
@@ -1516,6 +1523,7 @@ class Folder(CopyContainer, CMFBTreeFolder, CMFHBTreeFolder, Base, FolderMixIn):
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
:
...
...
@@ -1548,6 +1556,7 @@ class Folder(CopyContainer, CMFBTreeFolder, CMFHBTreeFolder, Base, FolderMixIn):
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
()
...
...
product/ERP5Type/tests/ERP5TypeTestCase.py
View file @
60e8992e
...
...
@@ -208,6 +208,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.
"""
...
...
@@ -769,6 +776,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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment