Edgewall Software
Modify

Opened 11 days ago

Last modified 11 days ago

#13886 assigned defect

[timeline] max_daysback option set to `-1` doesn't work

Reported by: Jun Omae Owned by: Jun Omae
Priority: normal Milestone: 1.6.1
Component: timeline Version: 1.2
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Originally reported at gmessage:trac-users:IC701Q0mnz0/m/oAbQHgP_CwA.

According to document of [timeline] max_daysback option, setting -1 to the option allows unlimited for daysback input. However, actually not work.

Attachments (0)

Change History (1)

comment:1 by Jun Omae, 11 days ago

Proposed changes:

  • trac/timeline/tests/web_ui.py

    diff --git a/trac/timeline/tests/web_ui.py b/trac/timeline/tests/web_ui.py
    index d6f170675..8fb33f3f0 100644
    a b class TimelineModuleTestCase(unittest.TestCase):  
    180180
    181181        self.assertEqual(90, data['daysback'])
    182182
     183    def test_max_daysback_unlimited(self):
     184        """Daysback is unlimited if [timeline] max_daysback set to -1."""
     185        self.env.config.set('timeline', 'max_daysback', '-1')
     186        req = MockRequest(self.env, args={'daysback': '365'})
     187        data = TimelineModule(self.env).process_request(req)[1]
     188        self.assertEqual(365, data['daysback'])
     189
    183190    def test_daysback_invalid_default_is_used(self):
    184191        """Daysback request value is invalid: default value is used."""
    185192        req = MockRequest(self.env, args={'daysback': '--'})
  • trac/timeline/web_ui.py

    diff --git a/trac/timeline/web_ui.py b/trac/timeline/web_ui.py
    index 0136b0e49..a4355448a 100644
    a b class TimelineModule(Component):  
    135135
    136136        pref = req.session.as_int('timeline.daysback', self.default_daysback)
    137137        default = 90 if format == 'rss' else pref
    138         daysback = req.args.as_int('daysback', default,
    139                                    min=0, max=self.max_daysback)
     138        max_daysback = self.max_daysback
     139        daysback = req.args.as_int('daysback', default, min=0,
     140                                   max=max_daysback if max_daysback >= 0 else
     141                                       None)
    140142
    141143        authors = req.args.get('authors')
    142144        if authors is None and format != 'rss':

Modify Ticket

Change Properties
Set your email in Preferences
Action
as assigned The owner will remain Jun Omae.
The ticket will be disowned. Next status will be 'new'.
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from Jun Omae 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.