diff mercurial/hgweb/hgweb_mod.py @ 50925:d718eddf01d9

safehasattr: drop usage in favor of hasattr The two functions should now be equivalent at least in their usage in core.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 31 Aug 2023 23:56:15 +0200
parents b2b8c25f9462
children 18c8c18993f0
line wrap: on
line diff
--- a/mercurial/hgweb/hgweb_mod.py	Thu Dec 08 15:33:19 2022 +0100
+++ b/mercurial/hgweb/hgweb_mod.py	Thu Aug 31 23:56:15 2023 +0200
@@ -34,7 +34,6 @@
     templater,
     templateutil,
     ui as uimod,
-    util,
     wireprotoserver,
 )
 
@@ -403,7 +402,7 @@
                 cmd = cmd[style + 1 :]
 
             # avoid accepting e.g. style parameter as command
-            if util.safehasattr(webcommands, pycompat.sysstr(cmd)):
+            if hasattr(webcommands, pycompat.sysstr(cmd)):
                 req.qsparams[b'cmd'] = cmd
 
             if cmd == b'static':
@@ -478,7 +477,7 @@
 
         except (error.LookupError, error.RepoLookupError) as err:
             msg = pycompat.bytestr(err)
-            if util.safehasattr(err, 'name') and not isinstance(
+            if hasattr(err, 'name') and not isinstance(
                 err, error.ManifestLookupError
             ):
                 msg = b'revision not found: %s' % err.name