Patchwork D1077: hgweb: rewrite two X or Y and Z ad-hoc ternaries with Y if X else Z

login
register
mail settings
Submitter phabricator
Date Oct. 14, 2017, 8:16 p.m.
Message ID <differential-rev-PHID-DREV-katfd7c2gufytakdlhd5-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/24908/
State Superseded
Headers show

Comments

phabricator - Oct. 14, 2017, 8:16 p.m.
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Just easier to muddle through for my brain now that I don't see the
  old pattern much anymore.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1077

AFFECTED FILES
  mercurial/hgweb/hgweb_mod.py
  mercurial/hgweb/hgwebdir_mod.py

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/hgweb/hgwebdir_mod.py b/mercurial/hgweb/hgwebdir_mod.py
--- a/mercurial/hgweb/hgwebdir_mod.py
+++ b/mercurial/hgweb/hgwebdir_mod.py
@@ -508,7 +508,7 @@ 
         if style == styles[0]:
             vars['style'] = style
 
-        start = url[-1] == '?' and '&' or '?'
+        start = '&' if url[-1] == '?' else '?'
         sessionvars = webutil.sessionvars(vars, start)
         logourl = config('web', 'logourl')
         logoimg = config('web', 'logoimg')
diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py
+++ b/mercurial/hgweb/hgweb_mod.py
@@ -187,7 +187,7 @@ 
         if style == styles[0]:
             vars['style'] = style
 
-        start = req.url[-1] == '?' and '&' or '?'
+        start = '&' if req.url[-1] == '?' else '?'
         sessionvars = webutil.sessionvars(vars, start)
 
         if not self.reponame: