diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
index c67fb3bfe3a1a43d38e1dffc8c7cdc301029f80f_bWVyY3VyaWFsL2hnd2ViL3dlYmNvbW1hbmRzLnB5..1fe3c8296cfe28834e259dec5f39760c60fd3b5d_bWVyY3VyaWFsL2hnd2ViL3dlYmNvbW1hbmRzLnB5 100644
--- a/mercurial/hgweb/webcommands.py
+++ b/mercurial/hgweb/webcommands.py
@@ -413,7 +413,7 @@
     else:
         nextentry = []
 
-    return tmpl(shortlog and 'shortlog' or 'changelog', changenav=changenav,
+    return tmpl('shortlog' if shortlog else 'changelog', changenav=changenav,
                 node=ctx.hex(), rev=pos, symrev=symrev, changesets=count,
                 entries=entries,
                 latestentry=latestentry, nextentry=nextentry,
diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py
index c67fb3bfe3a1a43d38e1dffc8c7cdc301029f80f_bWVyY3VyaWFsL2hnd2ViL3dlYnV0aWwucHk=..1fe3c8296cfe28834e259dec5f39760c60fd3b5d_bWVyY3VyaWFsL2hnd2ViL3dlYnV0aWwucHk= 100644
--- a/mercurial/hgweb/webutil.py
+++ b/mercurial/hgweb/webutil.py
@@ -411,7 +411,7 @@
     files = []
     parity = paritygen(web.stripecount)
     for blockno, f in enumerate(ctx.files()):
-        template = f in ctx and 'filenodelink' or 'filenolink'
+        template = 'filenodelink' if f in ctx else 'filenolink'
         files.append(tmpl(template,
                           node=ctx.hex(), file=f, blockno=blockno + 1,
                           parity=next(parity)))
@@ -572,7 +572,7 @@
 
     fileno = 0
     for filename, adds, removes, isbinary in stats:
-        template = filename in files and 'diffstatlink' or 'diffstatnolink'
+        template = 'diffstatlink' if filename in files else 'diffstatnolink'
         total = adds + removes
         fileno += 1
         yield tmpl(template, node=ctx.hex(), file=filename, fileno=fileno,