Modify ↓
Opened 3 years ago
Last modified 3 years ago
#14141 accepted enhancement
Allow wiki-Syntax in scalar.py
Reported by: | anonymous | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | normal | Component: | WikiTableMacro |
Severity: | normal | Keywords: | patch |
Cc: | Ryan J Ollos | Trac Release: | 1.4 |
Description
Since r14524 it is not possible to include wiki-syntax to scalar-value output. For example, it is a nice feature to count the tickets of a user and point to the corresponding report:
{{{#!SQLScalar SELECT '([query:?status=!closed&owner={{1}} '||count(id)||'],' FROM ticket WHERE status!="closed" AND owner="{{1}}" }}}
The previous behaviour can be restored with the following patch:
-
(a) a/scalar.py.orig vs. (b) b/scalar.py
diff --git a/scalar.py.orig b/scalar.py index 0a9657a..037147c 100644
a b 9 9 # 10 10 11 11 from trac.web.chrome import add_stylesheet 12 from trac.wiki.formatter import system_message12 from trac.wiki.formatter import format_to_oneliner, system_message 13 13 from trac.wiki.macros import WikiMacroBase 14 14 from trac.util.html import html as tag 15 15 from trac.util.text import exception_to_unicode 16 16 from trac.util.translation import _ 17 17 18 19 18 class SQLScalar(WikiMacroBase): 20 19 """Output a number from a scalar (1x1) SQL query. 21 20 … … class SQLScalar(WikiMacroBase): 39 38 else: 40 39 value = rows[0][0] if len(rows) else "(NULL)" 41 40 42 add_stylesheet(formatter.req, 'wikitable/css/wikitable.css') 43 return tag.span(value, class_='wikiscalar') 41 return format_to_oneliner(self.env, formatter.context, value)
Attachments (0)
Change History (2)
comment:1 Changed 3 years ago by
Keywords: | patch added |
---|
comment:2 Changed 3 years ago by
Owner: | set to Ryan J Ollos |
---|---|
Status: | new → accepted |
Note: See
TracTickets for help on using
tickets.