#12679 closed defect (fixed)
TypeError: add_script_data() got an unexpected keyword argument 'dynvars'
Reported by: | Gerd | Owned by: | Jun Omae |
---|---|---|---|
Priority: | normal | Component: | DynamicVariablesPlugin |
Severity: | normal | Keywords: | |
Cc: | Trac Release: | 0.12 |
Description
I installed the plugin on a TRAC 0.12.3 server.
I tried the example report:
SELECT p.value AS __color__, t.id AS ticket, summary, component, severity, reporter FROM ticket t LEFT OUTER JOIN milestone m ON t.milestone = m.name LEFT JOIN enum p ON p.name = t.severity AND p.type = 'severity' LEFT OUTER JOIN ticket_custom q ON q.ticket = t.id AND q.name = 'queue' WHERE q.value = '$QUEUE' AND milestone = '$MILESTONE' ORDER BY m.due ASC, p.value
but got the following error:
Warning: The following arguments are missing: QUEUE The following arguments are missing: QUEUE, MILESTONE Trac detected an internal error: TypeError: add_script_data() got an unexpected keyword argument 'dynvars' Python Traceback Most recent call last: File "C:/Python27/lib/site-packages/trac/web/main.py", line 522, in _dispatch_request dispatcher.dispatch(req) File "C:/Python27/lib/site-packages/trac/web/main.py", line 254, in dispatch self._post_process_request(req, *resp) File "C:/Python27/lib/site-packages/trac/web/main.py", line 363, in _post_process_request resp = f.post_process_request(req, *resp) File "build/bdist.win32/egg/dynvars/web_ui.py", line 44, in post_process_request add_script_data(req, dynvars=dynvars) System Information: Trac 0.12.3 Babel 0.9.5 Genshi 0.6 pysqlite 2.6.0 Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] setuptools 0.6c11 SQLite 3.6.21
not sure what caused this, maybe any connection to Changeset 14917? ('Use add_script_data to pass data to the script.')
Attachments (1)
Change History (13)
comment:1 Changed 9 years ago by
comment:2 Changed 9 years ago by
The add_script_data
since Trac 1.0 accepts keyword arguments. The following patch would probably make compatible between 0.12 and 1.0.
-
dynamicvariablesplugin/0.12/dynvars/web_ui.py
diff --git a/dynamicvariablesplugin/0.12/dynvars/web_ui.py b/dynamicvariablesplugin/0.12/dynvars/web_ui.py index 1f69ba2..146ff3a 100644
a b class DynamicVariablesModule(Component): 41 41 report = self._get_report(req, check_referer=True) 42 42 for var in self._extract_vars(report): 43 43 dynvars[var] = self._get_options(var.lower()) 44 add_script_data(req, dynvars=dynvars)44 add_script_data(req, {'dynvars': dynvars}) 45 45 return template, data, content_type 46 46 47 47 # Private methods
Changed 9 years ago by
Attachment: | Trac_milestone_dropdown.PNG added |
---|
Screenshot empty Milestone drop down
comment:3 follow-ups: 4 9 Changed 9 years ago by
I used the supplied patch: error message is gone now :) Thank you!
But I still don't get the Milestone dropdown list (see screenshot). Is it an issue of my 0.12 trac server? Maybe I should use an older version of the plugin ?
comment:4 follow-up: 6 Changed 9 years ago by
Owner: | changed from Rob Guttman to Ryan J Ollos |
---|---|
Status: | new → accepted |
Replying to gerd_h:
I used the supplied patch: error message is gone now :) Thank you!
I'll apply the patch.
But I still don't get the Milestone dropdown list (see screenshot). Is it an issue of my 0.12 trac server? Maybe I should use an older version of the plugin ?
I haven't done any testing with Trac 0.12. You could try the 0.12 branch, or just upgrade your Trac instance. Trac 1.0 was released in 2012.
comment:6 Changed 9 years ago by
Replying to rjollos:
I haven't done any testing with Trac 0.12. You could try the 0.12 branch, or just upgrade your Trac instance. Trac 1.0 was released in 2012.
Sorry, I was confusing this with DynamicFieldsPlugin which has forked from 0.12 to the trunk. I see that mainline development is still occurring in the 0.12 branch for DynamicVariablesPlugin.
Could you post the SQL for a report in which you find the milestone dropdown to be empty? I'll try to reproduce.
comment:7 Changed 9 years ago by
This is the given example from the plug-in's homepage, slightly adapted as I have no 'queue' entries in ticket_custom:
SELECT p.value AS __color__, t.id AS ticket, summary, component, severity, reporter FROM ticket t LEFT OUTER JOIN milestone m ON t.milestone = m.name LEFT JOIN enum p ON p.name = t.severity AND p.type = 'severity' LEFT OUTER JOIN ticket_custom q ON q.ticket = t.id AND q.name = 'queue' WHERE milestone = '$MILESTONE' ORDER BY m.due ASC, p.value
comment:8 Changed 9 years ago by
Another issue, maybe related:
SELECT * FROM ticket as t WHERE (t.status <> 'closed') and (t.status not in ($STATUS1) )
The relevant parts of my trac.ini look like:
[components] dynvars.web_ui.dynamicvariablesmodule = enabled [dynvars] status1.options = documenting
I expected to have a drop-down list for status1, but I only get an empty edit box (default trac behaviour without plugin)
comment:9 follow-up: 10 Changed 9 years ago by
But I still don't get the Milestone dropdown list (see screenshot). Is it an issue of my 0.12 trac server? Maybe I should use an older version of the plugin ?
I guess the same issue exists with Trac 1.0. Could you pleaes try the following patch? I verified with Trac 0.12.x.
-
dynamicvariablesplugin/0.12/dynvars/htdocs/dynamic_variables.js
diff --git a/dynamicvariablesplugin/0.12/dynvars/htdocs/dynamic_variables.js b/dynamicvariablesplugin/0.12/dynvars/htdocs/dynamic_va index 980d148..054e2ca 100644
a b jQuery(document).ready(function($) { 7 7 var $input = $('input[name="' + field + '"]', $filters); 8 8 if ($input.length != 0) { 9 9 var $select = $('<select>').insertAfter($input); 10 $ (options).each(function() {11 $select.append($('<option >').attr('value', this).text(this));10 $.each(options, function(key, val) { 11 $select.append($('<option />').attr('value', val).text(val)); 12 12 }); 13 13 $input.hide(); 14 14 $select.val($input.val()).change(function() {
comment:10 Changed 9 years ago by
Replying to jun66j5:
I guess the same issue exists with Trac 1.0. Could you pleaes try the following patch? I verified with Trac 0.12.x.
Will do, but currently I am swamped with something else :(
I hope I can test the patch next week ...
comment:12 Changed 9 years ago by
Owner: | changed from Ryan J Ollos to Jun Omae |
---|
I get the same error when trying this report: