Commit d1a6a688 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

py2/py3: 2to3 -f methodattrs

parent b5193345
...@@ -304,7 +304,7 @@ class TestBigFile(ERP5TypeTestCase): ...@@ -304,7 +304,7 @@ class TestBigFile(ERP5TypeTestCase):
# NOTE this change is automatically reverted back in calling helper # NOTE this change is automatically reverted back in calling helper
self.assertIsInstance(f._baseGetData._default, str) self.assertIsInstance(f._baseGetData._default, str)
self.assertEqual(f._baseGetData._default, '') self.assertEqual(f._baseGetData._default, '')
f._baseGetData.im_func._default = None # NOTE not possible to do on just f._baseGetData f._baseGetData.__func__._default = None # NOTE not possible to do on just f._baseGetData
self.assertIs(f._baseGetData._default, None) self.assertIs(f._baseGetData._default, None)
self.assertIs(f._baseGetData(), None) # <- oops self.assertIs(f._baseGetData(), None) # <- oops
...@@ -338,7 +338,7 @@ class TestBigFile(ERP5TypeTestCase): ...@@ -338,7 +338,7 @@ class TestBigFile(ERP5TypeTestCase):
self.assertEqual(_, '') self.assertEqual(_, '')
# NOTE obtaining getter is not possible via BigFile._baseGetData # NOTE obtaining getter is not possible via BigFile._baseGetData
g = f._baseGetData.im_func g = f._baseGetData.__func__
self.assertIsInstance(g._default, str) self.assertIsInstance(g._default, str)
self.assertEqual(g._default, '') self.assertEqual(g._default, '')
......
...@@ -66,10 +66,10 @@ class TestRenderViewAPI(ERP5TypeTestCase): ...@@ -66,10 +66,10 @@ class TestRenderViewAPI(ERP5TypeTestCase):
def test_signature(self): def test_signature(self):
for field in FieldRegistry.get_field_classes().itervalues(): # pylint: disable=no-value-for-parameter for field in FieldRegistry.get_field_classes().itervalues(): # pylint: disable=no-value-for-parameter
self.assertEqual(('self', 'value', 'REQUEST', 'render_prefix'), self.assertEqual(('self', 'value', 'REQUEST', 'render_prefix'),
field.render_view.im_func.func_code.co_varnames) field.render_view.__func__.func_code.co_varnames)
if field is not ProxyField: if field is not ProxyField:
self.assertEqual(('self', 'field', 'value', 'REQUEST'), self.assertEqual(('self', 'field', 'value', 'REQUEST'),
field.widget.render_view.im_func.func_code.co_varnames[:4], '%s %s' % (field.widget, field.widget.render_view.im_func.func_code.co_varnames[:4])) field.widget.render_view.__func__.func_code.co_varnames[:4], '%s %s' % (field.widget, field.widget.render_view.__func__.func_code.co_varnames[:4]))
class TestFloatField(ERP5TypeTestCase): class TestFloatField(ERP5TypeTestCase):
......
...@@ -72,7 +72,7 @@ class DummyMovement(Movement): ...@@ -72,7 +72,7 @@ class DummyMovement(Movement):
parent = self.getParentValue() parent = self.getParentValue()
if isinstance(parent, DummyDelivery): if isinstance(parent, DummyDelivery):
self = parent self = parent
return DummyDelivery.getSimulationState.im_func(self) return DummyDelivery.getSimulationState.__func__(self)
def getDeliveryValue(self): def getDeliveryValue(self):
""" """
......
...@@ -198,10 +198,10 @@ DCWorkflowDefinition.listObjectActions = ERP5Workflow.__dict__['listObjectAction ...@@ -198,10 +198,10 @@ DCWorkflowDefinition.listObjectActions = ERP5Workflow.__dict__['listObjectAction
from Products.DCWorkflow.Expression import Expression from Products.DCWorkflow.Expression import Expression
DCWorkflowDefinition.security.declarePrivate('getWorklistVariableMatchDict') DCWorkflowDefinition.security.declarePrivate('getWorklistVariableMatchDict')
DCWorkflowDefinition.getWorklistVariableMatchDict = ERP5Workflow.getWorklistVariableMatchDict.im_func DCWorkflowDefinition.getWorklistVariableMatchDict = ERP5Workflow.getWorklistVariableMatchDict.__func__
DCWorkflowDefinition.security.declarePrivate('isWorkflowMethodSupported') DCWorkflowDefinition.security.declarePrivate('isWorkflowMethodSupported')
DCWorkflowDefinition.isWorkflowMethodSupported = ERP5Workflow.isWorkflowMethodSupported.im_func DCWorkflowDefinition.isWorkflowMethodSupported = ERP5Workflow.isWorkflowMethodSupported.__func__
TransitionDefinition__init__orig = TransitionDefinition.__init__ TransitionDefinition__init__orig = TransitionDefinition.__init__
def TransitionDefinition__init__(self, *args, **kw): def TransitionDefinition__init__(self, *args, **kw):
...@@ -421,7 +421,7 @@ def _executeMetaTransition(self, ob, new_state_id): ...@@ -421,7 +421,7 @@ def _executeMetaTransition(self, ob, new_state_id):
DCWorkflowDefinition._executeMetaTransition = _executeMetaTransition DCWorkflowDefinition._executeMetaTransition = _executeMetaTransition
DCWorkflowDefinition.wrapWorkflowMethod = ERP5Workflow.wrapWorkflowMethod.im_func DCWorkflowDefinition.wrapWorkflowMethod = ERP5Workflow.wrapWorkflowMethod.__func__
def StateDefinition_getStatePermissionRoleListDict(self): def StateDefinition_getStatePermissionRoleListDict(self):
if self.permission_roles is None: if self.permission_roles is None:
...@@ -878,7 +878,7 @@ def method_getGuardExpressionInstance(self): ...@@ -878,7 +878,7 @@ def method_getGuardExpressionInstance(self):
return self.guard.expr return self.guard.expr
def method_checkGuard(self, *args, **kwargs): def method_checkGuard(self, *args, **kwargs):
return ERP5Guardable.checkGuard.im_func(self, *args, **kwargs) return ERP5Guardable.checkGuard.__func__(self, *args, **kwargs)
def method_getAction(self): def method_getAction(self):
return self.actbox_url return self.actbox_url
...@@ -1207,9 +1207,9 @@ DCWorkflowDefinition.getTitle = method_getTitle ...@@ -1207,9 +1207,9 @@ DCWorkflowDefinition.getTitle = method_getTitle
DCWorkflowDefinition.getDescription = method_getDescription DCWorkflowDefinition.getDescription = method_getDescription
DCWorkflowDefinition.isManagerBypass = lambda self: self.manager_bypass DCWorkflowDefinition.isManagerBypass = lambda self: self.manager_bypass
DCWorkflowDefinition.getSourceValue = DCWorkflowDefinition_getSourceValue DCWorkflowDefinition.getSourceValue = DCWorkflowDefinition_getSourceValue
DCWorkflowDefinition.notifyWorkflowMethod = ERP5Workflow.notifyWorkflowMethod.im_func DCWorkflowDefinition.notifyWorkflowMethod = ERP5Workflow.notifyWorkflowMethod.__func__
DCWorkflowDefinition.notifyBefore = ERP5Workflow.notifyBefore.im_func DCWorkflowDefinition.notifyBefore = ERP5Workflow.notifyBefore.__func__
DCWorkflowDefinition.notifySuccess = ERP5Workflow.notifySuccess.im_func DCWorkflowDefinition.notifySuccess = ERP5Workflow.notifySuccess.__func__
DCWorkflowDefinition.getVariableValueDict = DCWorkflowDefinition_getVariableValueDict DCWorkflowDefinition.getVariableValueDict = DCWorkflowDefinition_getVariableValueDict
DCWorkflowDefinition.getVariableValueByReference = DCWorkflowDefinition_getVariableValueByReference DCWorkflowDefinition.getVariableValueByReference = DCWorkflowDefinition_getVariableValueByReference
DCWorkflowDefinition.getStateValueByReference = DCWorkflowDefinition_getStateValueByReference DCWorkflowDefinition.getStateValueByReference = DCWorkflowDefinition_getStateValueByReference
......
...@@ -75,7 +75,7 @@ def patchActivityTool(): ...@@ -75,7 +75,7 @@ def patchActivityTool():
def __init__(self, ob): def __init__(self, ob):
self._ob = ob self._ob = ob
def __getattr__(self, attr): def __getattr__(self, attr):
m = getattr(self._ob, attr).im_func m = getattr(self._ob, attr).__func__
return lambda *args, **kw: m(self, *args, **kw) return lambda *args, **kw: m(self, *args, **kw)
@patch @patch
def manage_setDistributingNode(self, distributingNode, REQUEST=None): def manage_setDistributingNode(self, distributingNode, REQUEST=None):
......
...@@ -87,6 +87,9 @@ class Python3StyleTest(ERP5TypeTestCase): ...@@ -87,6 +87,9 @@ class Python3StyleTest(ERP5TypeTestCase):
def test_importFixApplied(self): def test_importFixApplied(self):
self._testFixer('import') self._testFixer('import')
def test_methodattrsFixApplied(self):
self._testFixer('methodattrs')
def test_numliteralsFixApplied(self): def test_numliteralsFixApplied(self):
self._testFixer('numliterals') self._testFixer('numliterals')
......
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