Edgewall Software

Opened 9 years ago

Closed 8 years ago

Last modified 7 years ago

#12219 closed enhancement (fixed)

Add a Report model class to report.py — at Version 4

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Milestone: 1.2
Component: report system Version:
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:

Extracted a Report model class in trac.ticket.report.

Internal Changes:

Description (last modified by Ryan J Ollos)

The SQL in the ReportModule could be extracted to a Report model class, providing a better API for plugins to make use of.

Change History (4)

comment:1 by Ryan J Ollos, 9 years ago

Description: modified (diff)

comment:2 by Ryan J Ollos, 8 years ago

API Changes: modified (diff)

comment:3 by Jun Omae, 8 years ago

2 failures with PostgreSQL.

======================================================================
ERROR: test (trac.wiki.tests.formatter.WikiTestCase)
Test report link with non-digits
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/run/shm/2c9ac20f9f3bf68bd7fa7420be149c6a35745d18/py27-postgres/trac/wiki/tests/formatter.py", line 209, in test
    v = unicode(formatter.generate(**self.generate_opts))
  File "/run/shm/2c9ac20f9f3bf68bd7fa7420be149c6a35745d18/py27-postgres/trac/wiki/formatter.py", line 1545, in generate
    escape_newlines)
  File "/run/shm/2c9ac20f9f3bf68bd7fa7420be149c6a35745d18/py27-postgres/trac/wiki/formatter.py", line 1327, in format
    result = re.sub(self.wikiparser.rules, self.replace, line)
  File "/home/jun66j5/venv/py27-1.1/lib/python2.7/re.py", line 151, in sub
    return _compile(pattern, flags).sub(repl, string, count)
  File "/run/shm/2c9ac20f9f3bf68bd7fa7420be149c6a35745d18/py27-postgres/trac/wiki/formatter.py", line 1245, in replace
    replacement = self.handle_match(fullmatch)
  File "/run/shm/2c9ac20f9f3bf68bd7fa7420be149c6a35745d18/py27-postgres/trac/wiki/formatter.py", line 1241, in handle_match
    return internal_handler(match, fullmatch)
  File "/run/shm/2c9ac20f9f3bf68bd7fa7420be149c6a35745d18/py27-postgres/trac/wiki/formatter.py", line 622, in _shref_formatter
    return self._make_link(ns, target, match, match, fullmatch)
  File "/run/shm/2c9ac20f9f3bf68bd7fa7420be149c6a35745d18/py27-postgres/trac/wiki/formatter.py", line 673, in _make_link
    fullmatch)
  File "/run/shm/2c9ac20f9f3bf68bd7fa7420be149c6a35745d18/py27-postgres/trac/ticket/report.py", line 1001, in _format_link
    Report(self.env, id)
  File "/run/shm/2c9ac20f9f3bf68bd7fa7420be149c6a35745d18/py27-postgres/trac/ticket/report.py", line 124, in __init__
    """, (id,)):
  File "/run/shm/2c9ac20f9f3bf68bd7fa7420be149c6a35745d18/py27-postgres/trac/db/api.py", line 122, in execute
    return db.execute(query, params)
  File "/run/shm/2c9ac20f9f3bf68bd7fa7420be149c6a35745d18/py27-postgres/trac/db/util.py", line 128, in execute
    cursor.execute(query, params if params is not None else [])
  File "/run/shm/2c9ac20f9f3bf68bd7fa7420be149c6a35745d18/py27-postgres/trac/db/util.py", line 61, in execute
    r = self.cursor.execute(sql_escape_percent(sql), args)
DataError: invalid input syntax for integer: "blah"
LINE 3:                     WHERE id='blah'
                                     ^


======================================================================
ERROR: test (trac.wiki.tests.formatter.OneLinerTestCase)
Test report link with non-digits
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/run/shm/2c9ac20f9f3bf68bd7fa7420be149c6a35745d18/py27-postgres/trac/wiki/tests/formatter.py", line 209, in test
    v = unicode(formatter.generate(**self.generate_opts))
  File "/run/shm/2c9ac20f9f3bf68bd7fa7420be149c6a35745d18/py27-postgres/trac/wiki/formatter.py", line 1573, in generate
    shorten)
  File "/run/shm/2c9ac20f9f3bf68bd7fa7420be149c6a35745d18/py27-postgres/trac/wiki/formatter.py", line 1429, in format
    result = re.sub(self.wikiparser.rules, self.replace, result)
  File "/home/jun66j5/venv/py27-1.1/lib/python2.7/re.py", line 151, in sub
    return _compile(pattern, flags).sub(repl, string, count)
  File "/run/shm/2c9ac20f9f3bf68bd7fa7420be149c6a35745d18/py27-postgres/trac/wiki/formatter.py", line 1245, in replace
    replacement = self.handle_match(fullmatch)
  File "/run/shm/2c9ac20f9f3bf68bd7fa7420be149c6a35745d18/py27-postgres/trac/wiki/formatter.py", line 1241, in handle_match
    return internal_handler(match, fullmatch)
  File "/run/shm/2c9ac20f9f3bf68bd7fa7420be149c6a35745d18/py27-postgres/trac/wiki/formatter.py", line 622, in _shref_formatter
    return self._make_link(ns, target, match, match, fullmatch)
  File "/run/shm/2c9ac20f9f3bf68bd7fa7420be149c6a35745d18/py27-postgres/trac/wiki/formatter.py", line 673, in _make_link
    fullmatch)
  File "/run/shm/2c9ac20f9f3bf68bd7fa7420be149c6a35745d18/py27-postgres/trac/ticket/report.py", line 1001, in _format_link
    Report(self.env, id)
  File "/run/shm/2c9ac20f9f3bf68bd7fa7420be149c6a35745d18/py27-postgres/trac/ticket/report.py", line 124, in __init__
    """, (id,)):
  File "/run/shm/2c9ac20f9f3bf68bd7fa7420be149c6a35745d18/py27-postgres/trac/db/api.py", line 122, in execute
    return db.execute(query, params)
  File "/run/shm/2c9ac20f9f3bf68bd7fa7420be149c6a35745d18/py27-postgres/trac/db/util.py", line 128, in execute
    cursor.execute(query, params if params is not None else [])
  File "/run/shm/2c9ac20f9f3bf68bd7fa7420be149c6a35745d18/py27-postgres/trac/db/util.py", line 61, in execute
    r = self.cursor.execute(sql_escape_percent(sql), args)
DataError: invalid input syntax for integer: "blah"
LINE 3:                     WHERE id='blah'
                                     ^


----------------------------------------------------------------------
Ran 2139 tests in 316.904s

FAILED (errors=2)
make: *** [unit-test] Error 1

comment:4 by Ryan J Ollos, 8 years ago

API Changes: modified (diff)
Resolution: fixed
Status: assignedclosed
Type: defectenhancement

Committed to trunk in [14728].

Note: See TracTickets for help on using tickets.