Edgewall Software

Opened 8 years ago

Last modified 8 years ago

#12517 closed defect

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

Reported by: ebouaziz@… Owned by:
Priority: normal Milestone: 1.0.12
Component: wiki system Version: 1.0-stable
Severity: normal Keywords:
Cc: Branch:
Release Notes:
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 (0)

Note: See TracTickets for help on using tickets.