AutoMod: fix bug with int account threshold checks

It should be valid to define a check for one of the account thresholds
similar to:

    author:
        comment_karma: 0

to check for exactly that value. However, since this is parsed in as an
int, trying to do a regex match on it (to check for the presence of an
operator - equal/greater-than/less-than sign) crashes.

This ensures that the comparison value is converted to a string so that
the rest of the code can handle it.
This commit is contained in:
Chad Birch
2016-09-27 15:00:20 -06:00
parent 8f58a8fe00
commit 92b6e2fee2

View File

@@ -874,7 +874,7 @@ class RuleTarget(object):
for threshold in thresholds:
compare_value = getattr(self, threshold, None)
if compare_value is not None:
checks[threshold] = compare_value
checks[threshold] = str(compare_value)
# if we don't need to actually check anything, just return True
if not checks: