Modify

Opened 3 years ago

Closed 3 years ago

#11357 closed enhancement (fixed)

adding [testplan-tm_custom] custom=textarea causes exception during testplan loading

Reported by: JamesThomasMoon1979b Owned by: seccanj
Priority: normal Component: TestManagerForTracPlugin
Severity: minor Keywords:
Cc: JamesThomasMoon1979b Trac Release: 0.12

Description

Hi, I wanted to add a Comments field like recommended here. I added the following to conf/trac.ini

[testcaseinplan-tm_custom]
comments3 = textarea
comments3.format = wiki
comments3.label = Test Pass comments

[testplan-tm_custom]
comments3 = textarea
comments3.format = wiki
comments3.label = Test Pass comments

I restarted the webserver. Upon viewing a test plan, there is an exception

Trac detected an internal error:
KeyError: u'comments3'

If I change the field type from textarea to text then it works fine.

The full exception from the trac.log is

2013-10-22 15:04:56,400 Trac[main] ERROR: Internal Server Error: 
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/trac/web/main.py", line 511, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib/python2.7/dist-packages/trac/web/main.py", line 258, in dispatch
    content_type)
  File "/usr/lib/python2.7/dist-packages/trac/web/chrome.py", line 840, in render_template
    stream |= self._filter_stream(req, method, filename, stream, data)
  File "/usr/lib/python2.7/dist-packages/genshi/core.py", line 132, in __or__
    return Stream(_ensure(function(self)), serializer=self.serializer)
  File "/usr/lib/python2.7/dist-packages/trac/web/chrome.py", line 991, in inner
    data)
  File "/var/trac/trac/e/plugins/TestManager-1.7.1-py2.7.egg/testmanager/wiki.py", line 155, in filter_stream
    return self._testplan_wiki_view(req, formatter, page_name, planid, stream)
  File "/var/trac/trac/e/plugins/TestManager-1.7.1-py2.7.egg/testmanager/wiki.py", line 368, in _testplan_wiki_view
    HTML(self._build_testplan_tree(formatter.context, str(planid), page_name, mode, self.sortby, table_columns, table_columns_map, custom_ctx)),
  File "/var/trac/trac/e/plugins/TestManager-1.7.1-py2.7.egg/testmanager/wiki.py", line 1161, in _build_testplan_tree
    text += self._render_subtree_as_table(context, planid, components, ind, 0, table_columns, table_columns_map, custom_ctx)
  File "/var/trac/trac/e/plugins/TestManager-1.7.1-py2.7.egg/testmanager/wiki.py", line 1431, in _render_subtree_as_table
    text += self._render_subtree_as_table(context, planid, subcData, ind, level+1, table_columns, table_columns_map, custom_ctx, fulldetails)
  File "/var/trac/trac/e/plugins/TestManager-1.7.1-py2.7.egg/testmanager/wiki.py", line 1431, in _render_subtree_as_table
    text += self._render_subtree_as_table(context, planid, subcData, ind, level+1, table_columns, table_columns_map, custom_ctx, fulldetails)
  File "/var/trac/trac/e/plugins/TestManager-1.7.1-py2.7.egg/testmanager/wiki.py", line 1434, in _render_subtree_as_table
    text += self._render_testcases_as_table(context, planid, mtData, ind, level+1, table_columns, table_columns_map, custom_ctx, fulldetails)
  File "/var/trac/trac/e/plugins/TestManager-1.7.1-py2.7.egg/testmanager/wiki.py", line 1525, in _render_testcases_as_table
    text += self._get_custom_fields_columns(tcip, table_columns, table_columns_map, custom_ctx['testcaseinplan'][1])
  File "/var/trac/trac/e/plugins/TestManager-1.7.1-py2.7.egg/testmanager/wiki.py", line 1841, in _get_custom_fields_columns
    if table_columns_map[f['name']]['visible'] == 'True':
KeyError: u'comments3'

Attachments (0)

Change History (8)

comment:1 Changed 3 years ago by JamesThomasMoon1979b

  • Cc JamesThomasMoon1979b added; anonymous removed

comment:2 Changed 3 years ago by JamesThomasMoon1979b

It looks like this is a known TODO. From testmanager/wiki.py

    def _get_custom_fields_columns(self, obj, table_columns, table_columns_map, fields):
        result = u''

        for f in fields:
            if table_columns_map[f['name']]['visible'] == 'True':
                if f['type'] == 'text':
                    result += '<td>'
                    if obj[f['name']] is not None:
                        result += obj[f['name']]
                    result += '</td>'

                # TODO Support other field types

        return result

comment:3 Changed 3 years ago by JamesThomasMoon1979b

comment:4 Changed 3 years ago by seccanj

Hi James, exactly, as explained here, only text custom fields are currently supported.

Please, open an enhancement request to add other field types.

I'd appreciate a patch for this, as I'm currently really busy with my job this period and most probably won't be able to work on this issue.

Ciao, Roberto

comment:5 Changed 3 years ago by seccanj

  • Type changed from defect to enhancement

comment:6 Changed 3 years ago by seccanj

  • Status changed from new to accepted

comment:7 Changed 3 years ago by seccanj

All types of custom fields are now supported!

Check out the updated documentation here.

Released with 1.8.1: https://sourceforge.net/projects/testman4trac/files

comment:8 Changed 3 years ago by seccanj

  • Resolution set to fixed
  • Status changed from accepted to closed

Add Comment

Modify Ticket

Action
as closed The owner will remain seccanj.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.