Edgewall Software

Opened 8 years ago

Last modified 8 years ago

#12517 closed defect

invalid verification in `_arg_as_int()` — at Version 1

Reported by: ebouaziz@… Owned by: Ryan J Ollos
Priority: normal Milestone: 1.0.12
Component: wiki system Version: 1.0-stable
Severity: normal Keywords:
Cc: Branch:
Release Notes:

Fixed 0 not allowed as value for depth argument (regression in [14769]).

API Changes:
Internal Changes:

Description

the value returned by as_int() should be checked against None, otherwise we it is not possible to use 0 as value for some parameters as depth

example:

[[TitleIndex(Wiki, depth=0)]]

results in:

proposed fix:

  • trac/wiki/macros.py

    diff --git a/trac/wiki/macros.py b/trac/wiki/macros.py
    index 345cb53..450393d 100644
    a b class TracGuideTocMacro(WikiMacroBase):  
    915915
    916916def _arg_as_int(val, key=None, min=None, max=None):
    917917    int_val = as_int(val, None, min=min, max=max)
    918     if not int_val:
     918    if int_val is None:
    919919        raise MacroError(tag_("Invalid macro argument %(expr)s",
    920920                              expr=tag.code("%s=%s" % (key, val))
    921921                                   if key else tag.code(val)))

Change History (1)

comment:1 by Ryan J Ollos, 8 years ago

Milestone: 1.0.12
Owner: set to Ryan J Ollos
Release Notes: modified (diff)
Status: newassigned
Version: 1.2dev1.0-stable

Thanks for reporting. This is a regression in [14769] (#12370).

Note: See TracTickets for help on using tickets.