allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kentontay...@apache.org
Subject [allura] 02/03: [#8373] misc flake8-bugbear fixes
Date Mon, 10 Aug 2020 12:57:27 GMT
This is an automated email from the ASF dual-hosted git repository.

kentontaylor pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git

commit 53bf2a77eaae97a1ae7c5cba07dec1dab43a10cb
Author: Dave Brondsema <dave@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.


Mime
View raw message