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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Carlos Ramos Carreño
erp5
Commits
92d412a3
Commit
92d412a3
authored
Mar 15, 2023
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
py2/py3: update classes using __metaclass__
parent
f57e2210
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
16 deletions
+18
-16
bt5/erp5_forge/ModuleComponentTemplateItem/portal_components/module.erp5.WorkingCopy.py
...TemplateItem/portal_components/module.erp5.WorkingCopy.py
+8
-8
product/ERP5/bootstrap/erp5_core/ModuleComponentTemplateItem/portal_components/module.erp5.ExpandPolicy.py
...emplateItem/portal_components/module.erp5.ExpandPolicy.py
+10
-8
No files found.
bt5/erp5_forge/ModuleComponentTemplateItem/portal_components/module.erp5.WorkingCopy.py
View file @
92d412a3
...
...
@@ -43,6 +43,7 @@ from Products.ERP5.Document.BusinessTemplate import BusinessTemplateFolder
from
Products.ERP5Type.Utils
import
simple_decorator
from
six
import
string_types
as
basestring
from
six.moves
import
range
import
six
@
simple_decorator
def
selfcached
(
func
):
...
...
@@ -78,20 +79,19 @@ def issubdir(parent, child):
return
parent
==
child
or
child
.
startswith
(
parent
+
os
.
sep
)
ImplicitType
=
type
(
Implicit
)
class
WorkingCopyMetaClass
(
ImplicitType
):
def
__init__
(
cls
,
name
,
bases
,
d
):
# pylint: disable=no-self-argument,super-init-not-called
ImplicitType
.
__init__
(
cls
,
name
,
bases
,
d
)
# pylint: disable=non-parent-init-called
if
cls
.
reference
:
cls
.
_registry
.
append
((
cls
.
reference
,
cls
))
class
WorkingCopy
(
Implicit
):
class
WorkingCopy
(
six
.
with_metaclass
(
WorkingCopyMetaClass
,
Implicit
)):
__allow_access_to_unprotected_subobjects__
=
1
_registry
=
[]
reference
=
None
class
__metaclass__
(
ImplicitType
):
def
__init__
(
cls
,
name
,
bases
,
d
):
# pylint: disable=no-self-argument,super-init-not-called
ImplicitType
.
__init__
(
cls
,
name
,
bases
,
d
)
# pylint: disable=non-parent-init-called
if
cls
.
reference
:
cls
.
_registry
.
append
((
cls
.
reference
,
cls
))
def
__init__
(
self
,
path
=
None
,
restricted
=
False
):
if
path
:
self
.
working_copy
=
self
.
checkWorkingPath
(
path
,
restricted
)
...
...
product/ERP5/bootstrap/erp5_core/ModuleComponentTemplateItem/portal_components/module.erp5.ExpandPolicy.py
View file @
92d412a3
...
...
@@ -27,6 +27,7 @@
##############################################################################
import
six
from
time
import
time
import
transaction
from
Products.ERP5Type.UnrestrictedMethod
import
UnrestrictedMethod
...
...
@@ -54,16 +55,17 @@ policy_dict = {} # {None: preferred, 'foo_bar': FooBar}
VERTICAL_EXPAND_TIMEOUT
=
5
# XXX: hardcoded for the moment
class
_Policy
(
object
):
class
_PolicyMetaClass
(
type
):
"""Automatically register policies in policy_dict"""
def
__init__
(
cls
,
name
,
bases
,
d
):
type
.
__init__
(
cls
,
name
,
bases
,
d
)
if
name
[
0
]
!=
'_'
:
policy_dict
[
convertToLowerCase
(
name
)[
1
:]]
=
cls
class
_Policy
(
six
.
with_metaclass
(
_PolicyMetaClass
,
object
)):
"""Base class of policies for RuleMixin.expand and SimulationMovement.expand
"""
class
__metaclass__
(
type
):
"""Automatically register policies in policy_dict"""
def
__init__
(
cls
,
name
,
bases
,
d
):
type
.
__init__
(
cls
,
name
,
bases
,
d
)
if
name
[
0
]
!=
'_'
:
policy_dict
[
convertToLowerCase
(
name
)[
1
:]]
=
cls
def
__init__
(
self
,
activate_kw
=
None
):
self
.
activate_kw
=
activate_kw
...
...
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