Edgewall Software

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#12325 closed defect (fixed)

ValueError: invalid literal for int() with base 10: ')(,.",\'",[--' — at Version 1

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Milestone: 1.0.11
Component: general Version:
Severity: normal Keywords:
Cc: Branch:
Release Notes:

Coerce invalid asc argument to ReportModule to its default. This avoids a ValueError.

API Changes:
Internal Changes:

Description

2016-01-17 16:55:07,918 Trac[main] ERROR: Internal Server Error: <RequestWithSession "GET '/report?asc=%29%28%2C.%22%2C%27%22%2C%5B--&format=csv'">, referrer None
Traceback (most recent call last):
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/trac/web/main.py", line 554, in _dispatch_request
    dispatcher.dispatch(req)
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/trac/web/main.py", line 247, in dispatch
    resp = chosen_handler.process_request(req)
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/trac/ticket/report.py", line 176, in process_request
    template, data, content_type = self._render_list(req)
  File "/srv/trac-hacks.org/pve/lib/python2.7/site-packages/trac/ticket/report.py", line 296, in _render_list
    asc = bool(int(req.args.get('asc', 1)))
ValueError: invalid literal for int() with base 10: ')(,.",\'",[--'

Proposed fix:

  • trac/ticket/report.py

    diff --git a/trac/ticket/report.py b/trac/ticket/report.py
    index ec94423..958baa1 100644
    a b from trac.db import get_column_names  
    3030from trac.perm import IPermissionRequestor
    3131from trac.resource import Resource, ResourceNotFound
    3232from trac.ticket.api import TicketSystem
    33 from trac.util import as_int, content_disposition
     33from trac.util import as_bool, as_int, content_disposition
    3434from trac.util.datefmt import format_datetime, format_time, from_utimestamp
    3535from trac.util.presentation import Paginator
    3636from trac.util.text import exception_to_unicode, to_unicode, quote_query_string
    class ReportModule(Component):  
    293293    def _render_list(self, req):
    294294        """Render the list of available reports."""
    295295        sort = req.args.get('sort', 'report')
    296         asc = bool(int(req.args.get('asc', 1)))
     296        asc = as_bool(req.args.get('asc', 1))
    297297        format = req.args.get('format')
    298298
    299299        rows = self.env.db_query("""

Change History (1)

comment:1 by Ryan J Ollos, 8 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Fixed in [14485], merged in [14486].

Looks like some test failures, possibly due to Pygments 2.1. I'll investigate and open a new ticket if necessary.

Note: See TracTickets for help on using tickets.