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/07/31 18:38:59 UTC

[allura] 02/02: [#8373] misc flake8-bugbear fixes

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

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

commit 0cdd7d3477cd771584eef675c67785744cee0a7a
Author: Dave Brondsema <da...@brondsema.net>
AuthorDate: Fri Jul 31 14:38:39 2020 -0400

    [#8373] misc flake8-bugbear fixes
---
 Allura/allura/controllers/auth.py                                | 2 +-
 ForgeBlog/forgeblog/command/rssfeeds.py                          | 2 +-
 ForgeImporters/forgeimporters/trac/tests/functional/test_trac.py | 2 +-
 ForgeTracker/forgetracker/tracker_main.py                        | 4 ++--
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/Allura/allura/controllers/auth.py b/Allura/allura/controllers/auth.py
index 8b031cf..876bc0f 100644
--- a/Allura/allura/controllers/auth.py
+++ b/Allura/allura/controllers/auth.py
@@ -427,7 +427,7 @@ class AuthController(BaseController):
             return '%s does not include a repo mount point' % repo_path
         h.set_context(project.shortname,
                       rest[0], neighborhood=project.neighborhood)
-        if c.app is None or not getattr(c.app, 'repo'):
+        if c.app is None or not getattr(c.app, 'repo', None):
             return 'Cannot find repo at %s' % repo_path
         allura.tasks.repo_tasks.refresh.post()
         return '%r refresh queued.\n' % c.app.repo
diff --git a/ForgeBlog/forgeblog/command/rssfeeds.py b/ForgeBlog/forgeblog/command/rssfeeds.py
index d46319a..cc64d8a 100644
--- a/ForgeBlog/forgeblog/command/rssfeeds.py
+++ b/ForgeBlog/forgeblog/command/rssfeeds.py
@@ -131,7 +131,7 @@ class RssFeedsCommand(base.BlogCommand):
         else:
             content = plain2markdown(getattr(e, 'summary',
                                              getattr(e, 'subtitle',
-                                                     getattr(e, 'title'))))
+                                                     e.title)))
 
         content += ' [link](%s)' % e.link
         updated = datetime.utcfromtimestamp(calendar.timegm(e.updated_parsed))
diff --git a/ForgeImporters/forgeimporters/trac/tests/functional/test_trac.py b/ForgeImporters/forgeimporters/trac/tests/functional/test_trac.py
index bd9edfe..86626f2 100644
--- a/ForgeImporters/forgeimporters/trac/tests/functional/test_trac.py
+++ b/ForgeImporters/forgeimporters/trac/tests/functional/test_trac.py
@@ -47,7 +47,7 @@ class TestTracImportController(TestController):
         assert r.status_int == 302 and '/p/my-project' in r.location, \
             'Did not redirect as expected (status {} location {}).  Got a flash message: {} and inline errors: {}'.format(
                 r.status_int,
-                getattr(r, 'location'),
+                r.location,
                 self.webflash(r),
                 hasattr(r, 'html') and r.html.find('div', {'class': 'error'})
             )
diff --git a/ForgeTracker/forgetracker/tracker_main.py b/ForgeTracker/forgetracker/tracker_main.py
index 982a6ea..3b116c9 100644
--- a/ForgeTracker/forgetracker/tracker_main.py
+++ b/ForgeTracker/forgetracker/tracker_main.py
@@ -1184,7 +1184,7 @@ class BinController(BaseController, AdminControllerMixin):
             # Search threw an error.
             # Save the error on the bin object for displaying
             # in the template.
-            setattr(bin, 'error', str(e))
+            bin.error = str(e)
             # Expunge the bin object so we don't save the
             # errant search terms to mongo.
             M.session.artifact_orm_session.expunge(bin)
@@ -1248,7 +1248,7 @@ class BinController(BaseController, AdminControllerMixin):
                             # Search threw an error.
                             # Save the error on the bin object for displaying
                             # in the template.
-                            setattr(bin, 'error', str(e))
+                            bin.error = str(e)
                             errors = True
                             # Expunge the bin object so we don't save the
                             # errant search terms to mongo.