#12219 closed enhancement (fixed)
Add a Report model class to report.py
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 |
||
Internal Changes: |
Description (last modified by )
The SQL in the ReportModule could be extracted to a Report
model class, providing a better API for plugins to make use of.
Attachments (0)
Change History (9)
comment:1 by , 9 years ago
Description: | modified (diff) |
---|
comment:2 by , 9 years ago
API Changes: | modified (diff) |
---|
comment:3 by , 9 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 , 9 years ago
API Changes: | modified (diff) |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
Type: | defect → enhancement |
Committed to trunk in [14728].
comment:5 by , 9 years ago
I think we should move the Report
class to trac.ticket.model
…. Milestone
class is defined in trac.ticket.model
, not trac.ticket.roadmap
. Thoughts? Also, it might be good to add realm = 'report'
attribute like Ticket.realm
.
comment:6 by , 9 years ago
Those change sounds good: log:rjollos.git:t12219_report_module_refactoring.2.
comment:9 by , 8 years ago
Replying to Ryan J Ollos:
Report
tests moved from trac.ticket.tests.report
to trac.ticket.tests.model
in r15596, merged in r15597.
Proposed changes in log:rjollos.git:t12219_report_module_refactoring.