You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2020/04/13 20:34:02 UTC

[allura] 10/22: [#8356] __func__not needed in py3 for method attrs (in py2 is unbound method)

This is an automated email from the ASF dual-hosted git repository.

brondsem pushed a commit to branch db/8356
in repository https://gitbox.apache.org/repos/asf/allura.git

commit f825e3eb6d8bc284e20cb0bb68ea3fe59bb2f8d5
Author: Dave Brondsema <da...@brondsema.net>
AuthorDate: Fri Apr 10 10:14:51 2020 -0400

    [#8356] __func__not needed in py3 for method attrs (in py2 is unbound method)
---
 Allura/allura/tests/model/test_repo.py | 3 ++-
 Allura/allura/webhooks.py              | 4 ++--
 ForgeImporters/forgeimporters/base.py  | 3 ++-
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/Allura/allura/tests/model/test_repo.py b/Allura/allura/tests/model/test_repo.py
index 160f1ac..ed9f0e6 100644
--- a/Allura/allura/tests/model/test_repo.py
+++ b/Allura/allura/tests/model/test_repo.py
@@ -155,7 +155,8 @@ class TestLastCommit(unittest.TestCase):
         self.repo.get_changes = lambda _id: self._changes[_id]
         self._last_commits = [(None, set())]
         self.repo._get_last_commit = lambda i, p: self._last_commits.pop()
-        lcids = M.repository.RepositoryImplementation.last_commit_ids.__func__
+        lcids = M.repository.RepositoryImplementation.last_commit_ids
+        lcids = getattr(lcids, '__func__', lcids)
         self.repo.last_commit_ids = lambda *a, **k: lcids(self.repo, *a, **k)
         c.lcid_cache = {}
 
diff --git a/Allura/allura/webhooks.py b/Allura/allura/webhooks.py
index dafb5ce..a33a71b 100644
--- a/Allura/allura/webhooks.py
+++ b/Allura/allura/webhooks.py
@@ -92,12 +92,12 @@ class WebhookControllerMeta(type):
         if hasattr(cls, 'create'):
             cls.create = validate(
                 cls.create_form(),
-                error_handler=cls.index.__func__,
+                error_handler=getattr(cls.index, '__func__', cls.index),
             )(cls.create)
         if hasattr(cls, 'edit'):
             cls.edit = validate(
                 cls.edit_form(sender, app),
-                error_handler=cls._default.__func__,
+                error_handler=getattr(cls._default, '__func__', cls._default),
             )(cls.edit)
         return type.__call__(cls, sender, app, *args, **kw)
 
diff --git a/ForgeImporters/forgeimporters/base.py b/ForgeImporters/forgeimporters/base.py
index ab18bb4..13a7a7b 100644
--- a/ForgeImporters/forgeimporters/base.py
+++ b/ForgeImporters/forgeimporters/base.py
@@ -351,8 +351,9 @@ class ToolImportControllerMeta(type):
 
         """
         if hasattr(cls, 'create') and getattr(cls.create.decoration, 'validation', None) is None:
+            index_meth = getattr(cls.index, '__func__', cls.index)
             cls.create = validate(cls.import_form(aslist(importer.target_app)[0]),
-                    error_handler=cls.index.__func__)(cls.create)
+                                  error_handler=index_meth)(cls.create)
         return type.__call__(cls, importer, *args, **kw)