[damned-lies] Used the more idiomatic 'in' substring search



commit 2086129b6c9659f447e8e099185b952c3cb1cda0
Author: Claude Paroz <claude 2xlibre net>
Date:   Thu May 5 23:28:58 2016 +0200

    Used the more idiomatic 'in' substring search

 stats/models.py |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/stats/models.py b/stats/models.py
index f992259..13d2176 100644
--- a/stats/models.py
+++ b/stats/models.py
@@ -128,7 +128,7 @@ class Module(models.Model):
         return re.search(settings.VCS_HOME_REGEX, self.vcs_root) is not None
 
     def get_bugs_i18n_url(self, content=None):
-        if self.bugs_base.find("bugzilla") != -1 or self.bugs_base.find("freedesktop") != -1:
+        if "bugzilla" in self.bugs_base or "freedesktop" in self.bugs_base:
             link = utils.url_join(
                 self.bugs_base,
                 "buglist.cgi?product=%s&keywords_type=anywords&keywords=I18N+L10N"
@@ -140,7 +140,7 @@ class Module(models.Model):
             return None
 
     def get_bugs_enter_url(self):
-        if self.bugs_base.find("bugzilla") != -1 or self.bugs_base.find("freedesktop") != -1:
+        if "bugzilla" in self.bugs_base or "freedesktop" in self.bugs_base:
             link = utils.url_join(self.bugs_base, "enter_bug.cgi?product=%s&keywords=I18N+L10N" % 
(self.bugs_product,))
             if self.bugs_component:
                 link += "&component=%s" % self.bugs_component
@@ -325,7 +325,7 @@ class Branch(models.Model):
             return utils.url_join(self.module.vcs_root, self.module.name, "branches", self.name)
 
     def is_vcs_readonly(self):
-        return self.module.vcs_root.find('ssh://') == -1
+        return 'ssh://' not in self.module.vcs_root
 
     def get_vcs_web_url(self):
         if self.module.vcs_type in ('hg', 'git'):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]