[hawkmoth] Re: [PATCH] cautodoc: fix error message formatting on pattern not matching

  • From: Bruno Santos <brunomanuelsantos@xxxxxxxxxxxxxxxxxx>
  • To: hawkmoth@xxxxxxxxxxxxx, Jani Nikula <jani@xxxxxxxxxx>
  • Date: Thu, 27 Dec 2018 11:14:27 +0000



On 12/26/18 7:18 PM, Jani Nikula wrote:

Fixes

  File "/path/to/hawkmoth/__init__.py", line 68, in run
    env.app.warn(fmt.format(pattern),
KeyError: 'pat'

when the cautodoc directive filename pattern does not match any files.
---
 hawkmoth/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hawkmoth/__init__.py b/hawkmoth/__init__.py
index e3d4713e74ab..7f854002bc19 100644
--- a/hawkmoth/__init__.py
+++ b/hawkmoth/__init__.py
@@ -65,7 +65,7 @@ class CAutoDocDirective(Directive):
             filenames = glob.glob(env.config.cautodoc_root + '/' + pattern)
             if len(filenames) == 0:
                 fmt = 'Pattern "{pat}" does not match any files.'
-                env.app.warn(fmt.format(pattern),
+                env.app.warn(fmt.format(pat=pattern),
                              location=(env.docname, self.lineno))
                 continue
 


Nice ;)

-- 
Bruno Santos

PGP KEY: 941052CD (pool.sks-keyservers.net)

Other related posts: