Explorar el Código

Assert 'here' is not None rather than ignoring it
If '%(here)s' is found in the config file but the variable 'here' is
not a path string, it is either a bug or a test setup issue.

Mike Naberezny hace 9 años
padre
commit
b01795e8ab
Se han modificado 1 ficheros con 1 adiciones y 2 borrados
  1. 1 2
      supervisor/options.py

+ 1 - 2
supervisor/options.py

@@ -1747,12 +1747,11 @@ class UnhosedConfigParser(ConfigParser.RawConfigParser):
                             expansions=expansions, **kwargs)
                             expansions=expansions, **kwargs)
 
 
     def expand_here(self, here):
     def expand_here(self, here):
-        if here is None:
-            return
         HERE_FORMAT = '%(here)s'
         HERE_FORMAT = '%(here)s'
         for section in self.sections():
         for section in self.sections():
             for key, value in self.items(section):
             for key, value in self.items(section):
                 if HERE_FORMAT in value:
                 if HERE_FORMAT in value:
+                    assert here is not None, "here has not been set to a path"
                     value = value.replace(HERE_FORMAT, here)
                     value = value.replace(HERE_FORMAT, here)
                     self.set(section, key, value)
                     self.set(section, key, value)