Modify

Opened 10 years ago

Closed 10 years ago

#11357 closed enhancement (fixed)

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

Reported by: JamesThomasMoon1979 Owned by: Roberto Longobardi
Priority: normal Component: TestManagerForTracPlugin
Severity: minor Keywords:
Cc: JamesThomasMoon1979 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 10 years ago by JamesThomasMoon1979

Cc: JamesThomasMoon1979 added; anonymous removed

comment:2 Changed 10 years ago by JamesThomasMoon1979

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:4 Changed 10 years ago by Roberto Longobardi

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 10 years ago by Roberto Longobardi

Type: defectenhancement

comment:6 Changed 10 years ago by Roberto Longobardi

Status: newaccepted

comment:7 Changed 10 years ago by Roberto Longobardi

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 10 years ago by Roberto Longobardi

Resolution: fixed
Status: acceptedclosed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Roberto Longobardi.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


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

 
Note: See TracTickets for help on using tickets.