Menu

TypeError: coercing to Unicode: need string or buffer, NoneType found

Ralph
2013-04-01
2013-04-11
  • Ralph

    Ralph - 2013-04-01

    Hi Roberto,

    today I've upgraded to testman4trac 1.5.2 because I got the TypeError in previous version of testman4trac when clicking on test case title to display the descroption.

    But I found the same error in the latest version.

    Stack trace is below:

    2013-04-01 15:06:53,581 Trac[main] ERROR: Internal Server Error: 
    Traceback (most recent call last):
      File "build/bdist.linux-i686/egg/trac/web/main.py", line 513, in _dispatch_request
        dispatcher.dispatch(req)
      File "build/bdist.linux-i686/egg/trac/web/main.py", line 256, in dispatch
        content_type)
      File "build/bdist.linux-i686/egg/trac/web/chrome.py", line 816, in render_template
        stream |= self._filter_stream(req, method, filename, stream, data)
      File "build/bdist.linux-i686/egg/genshi/core.py", line 132, in __or__
        return Stream(_ensure(function(self)), serializer=self.serializer)
      File "build/bdist.linux-i686/egg/trac/web/chrome.py", line 955, in inner
        data)
      File "build/bdist.linux-i686/egg/testmanager/wiki.py", line 147, in filter_stream
        return self._testcase_wiki_view(req, formatter, planid, page_name, stream)
      File "build/bdist.linux-i686/egg/testmanager/wiki.py", line 469, in _testcase_wiki_view
        insert2.append(HTML(self._get_select_testplan_dialog_markup(req, test_case, tcat)))
      File "build/bdist.linux-i686/egg/testmanager/wiki.py", line 870, in _get_select_testplan_dialog_markup
        tp_search['page_name'] = 'TC_TT' + tcat['page_name'].partition('TC_TT')[2].partition('_')[0] + '%'
    AttributeError: 'NoneType' object has no attribute 'partition'
    

    I got the source code and added some small improvements.
    One near line 424:

    summary = str(test_case.title)
    

    And the next near 869:

    tcat_page_name = str(tcat['page_name'])
            # Go up to outer enclosing Test Catalog
            tp_search['page_name'] = 'TC_TT' + tcat_page_name.partition('TC_TT')[2].partition('_')[0] + str('%')
    

    Now I'm able to display the testcase description.
    I'm not familiar with Python (using Java wherever it's possible). Perhaps you can find a better solution for my workaround.

    Thank you for lots of work in TestManager4Trac!

    Best regards,
    Ralph

     

    Last edit: Ralph 2013-04-30
  • Roberto Longobardi

    Hi Ralph,
    thanks a lot Ralph for your fix.

    In the next release, which is about to come out, I'll try to better handle the case when the title is null.

    Thanks for your interest in this plugin. Ciao,
    Roberto

     

Log in to post a comment.