Fixed action parameter `timeout`: it is a time (integer), so avoid to convert it to string (for replacement); fix substituteRecursiveTags using auto-convert to string.

Closes gh-2241.
pull/2215/merge
sebres 6 years ago
parent 17da4943df
commit 6067579464

@ -429,7 +429,7 @@ def substituteRecursiveTags(inptags, conditional='',
m = tre_search(value, m.end()) m = tre_search(value, m.end())
continue continue
# if calling map - be sure we've string: # if calling map - be sure we've string:
if noRecRepl: repl = uni_string(repl) if not isinstance(repl, basestring): repl = uni_string(repl)
value = value.replace('<%s>' % rtag, repl) value = value.replace('<%s>' % rtag, repl)
#logSys.log(5, 'value now: %s' % value) #logSys.log(5, 'value now: %s' % value)
# increment reference count: # increment reference count:

@ -331,7 +331,7 @@ class CommandAction(ActionBase):
if not name.startswith('_') and not self.__init and not callable(value): if not name.startswith('_') and not self.__init and not callable(value):
# special case for some parameters: # special case for some parameters:
if name in ('timeout', 'bantime'): if name in ('timeout', 'bantime'):
value = str(MyTime.str2seconds(value)) value = MyTime.str2seconds(value)
# parameters changed - clear properties and substitution cache: # parameters changed - clear properties and substitution cache:
self.__properties = None self.__properties = None
self.__substCache.clear() self.__substCache.clear()

@ -661,11 +661,11 @@ class Transmitter(TransmitterBase):
self.assertEqual( self.assertEqual(
self.transm.proceed( self.transm.proceed(
["set", self.jailName, "action", action, "timeout", "10"]), ["set", self.jailName, "action", action, "timeout", "10"]),
(0, "10")) (0, 10))
self.assertEqual( self.assertEqual(
self.transm.proceed( self.transm.proceed(
["get", self.jailName, "action", action, "timeout"]), ["get", self.jailName, "action", action, "timeout"]),
(0, "10")) (0, 10))
self.assertEqual( self.assertEqual(
self.transm.proceed(["set", self.jailName, "delaction", action]), self.transm.proceed(["set", self.jailName, "delaction", action]),
(0, None)) (0, None))

Loading…
Cancel
Save