Edgewall Software
Modify

Opened 4 years ago

Closed 4 years ago

#12517 closed defect (fixed)

invalid verification in `_arg_as_int()`

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)))

Attachments (0)

Change History (2)

comment:1 by Ryan J Ollos, 4 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).

comment:2 by Ryan J Ollos, 4 years ago

Resolution: fixed
Status: assignedclosed

Fixed on 1.0-stable in [14850], merged to trunk in [14851].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Ryan J Ollos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.