Modify

Opened 11 years ago

Closed 11 years ago

#11142 closed defect (fixed)

export Test Cases or Test Catalogs fails with exception "AttributeError: 'NoneType' object has no attribute 'split'"

Reported by: jtmoon@… Owned by: Roberto Longobardi
Priority: normal Component: TestManagerForTracPlugin
Severity: normal Keywords: Export Test
Cc: Trac Release: 0.12

Description

Exporting Test Cases and Export Test Catalogs results in a python exception. It appears to be affected by checking the Include full description checkbox. trac is on fresh installed Ubuntu 12.04 host.


System Information

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.63 Safari/537.31

Trac	0.12.5
Genshi	0.6.1 (without speedups)
Pygments	1.4
pysqlite	2.6.0
Python	2.7.3 (default, Aug 1 2012, 05:14:39) [GCC 4.6.3]
setuptools	0.6
SQLite	3.7.9
jQuery	1.4.4
Enabled Plugins:

TestManager	1.6.2	/usr/local/lib/python2.7/dist-packages/TestManager-1.6.2-py2.7.egg
TracGenericClass	1.1.5	/usr/local/lib/python2.7/dist-packages/TracGenericClass-1.1.5-py2.7.egg
TracGenericWorkflow	1.0.4	/usr/local/lib/python2.7/dist-packages/TracGenericWorkflow-1.0.4-py2.7.egg

Partial DEBUG output follows, from the time of clicking the Export button :

2013-06-04 17:33:19,961 Trac[trac:main] DEBUG: Dispatching <Request "POST '/testexport'">
2013-06-04 17:33:19,961 Trac[trac:session] DEBUG: Retrieving session for ID 'f6cbeb2ec1b214414a8bd75a'
2013-06-04 17:33:19,962 Trac[trac:api] WARNING: Unable to find repository '(default)' for synchronization
2013-06-04 17:33:19,963 Trac[trac:model] DEBUG: Title: None
2013-06-04 17:33:19,963 Trac[trac:model] DEBUG: Description: None
2013-06-04 17:33:19,963 Trac[trac:model] DEBUG: >>> get_fields
2013-06-04 17:33:19,963 Trac[trac:model] DEBUG: <<< get_fields
2013-06-04 17:33:19,963 Trac[trac:model] DEBUG: >>> _fetch_object
2013-06-04 17:33:19,963 Trac[trac:model] DEBUG: Searching for testcatalog: WHERE 1=1 AND id=%%s
2013-06-04 17:33:19,964 Trac[trac:model] DEBUG: id = 0
2013-06-04 17:33:19,964 Trac[trac:model] DEBUG: Object found.
2013-06-04 17:33:19,964 Trac[trac:model] DEBUG: Title: Release 3.9
2013-06-04 17:33:19,964 Trac[trac:model] DEBUG: <<< _fetch_object
2013-06-04 17:33:19,964 Trac[trac:model] DEBUG: Exists: True
2013-06-04 17:33:19,965 Trac[trac:model] DEBUG: {'page_name': u'TC_TT0', 'id': u'0'}
2013-06-04 17:33:19,965 Trac[trac:model] DEBUG: >>> get_fields
2013-06-04 17:33:19,965 Trac[trac:model] DEBUG: <<< get_fields
...
2013-06-04 17:33:19,990 Trac[trac:model] DEBUG: >>> _fetch_object
2013-06-04 17:33:19,990 Trac[trac:model] DEBUG: Searching for testcase: WHERE 1=1 AND id=%%s
2013-06-04 17:33:19,990 Trac[trac:model] DEBUG: id = 1
2013-06-04 17:33:19,991 Trac[trac:model] DEBUG: Object found.
2013-06-04 17:33:19,991 Trac[trac:model] DEBUG: Title: Alert Basics
2013-06-04 17:33:19,991 Trac[trac:model] DEBUG: <<< _fetch_object
2013-06-04 17:33:19,991 Trac[trac:model] DEBUG: Exists: True
2013-06-04 17:33:19,991 Trac[trac:model] DEBUG: {'exec_order': 2, 'page_name': u'TC_TT0_TC1', 'id': u'1'}
2013-06-04 17:33:19,992 Trac[trac:model] DEBUG: Title: None
2013-06-04 17:33:19,992 Trac[trac:model] DEBUG: Description: None
2013-06-04 17:33:19,992 Trac[trac:model] DEBUG: >>> get_fields
2013-06-04 17:33:19,992 Trac[trac:model] DEBUG: <<< get_fields
2013-06-04 17:33:19,992 Trac[trac:model] DEBUG: >>> _fetch_object
2013-06-04 17:33:19,993 Trac[trac:model] DEBUG: Searching for testcase: WHERE 1=1 AND id=%%s
2013-06-04 17:33:19,993 Trac[trac:model] DEBUG: id = 2
2013-06-04 17:33:19,993 Trac[trac:model] DEBUG: Object found.
2013-06-04 17:33:19,993 Trac[trac:model] DEBUG: Title: Holiday In Cambodia
2013-06-04 17:33:19,993 Trac[trac:model] DEBUG: <<< _fetch_object
2013-06-04 17:33:19,994 Trac[trac:model] DEBUG: Exists: True
2013-06-04 17:33:19,994 Trac[trac:model] DEBUG: {'exec_order': 3, 'page_name': u'TC_TT0_TC2', 'id': u'2'}
2013-06-04 17:33:19,995 Trac[trac:main] ERROR: Internal Server Error: 
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/Trac-0.12.5-py2.7.egg/trac/web/main.py", line 522, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/local/lib/python2.7/dist-packages/Trac-0.12.5-py2.7.egg/trac/web/main.py", line 243, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/local/lib/python2.7/dist-packages/TestManager-1.6.2-py2.7.egg/testmanager/api.py", line 824, in process_request
    csvstr = self.get_catalog_model_csv_markup(context, planid, data_model, catid, separator, (planid != '-1'), fulldetails, raw_wiki_format)
  File "/usr/local/lib/python2.7/dist-packages/TestManager-1.6.2-py2.7.egg/testmanager/api.py", line 1470, in get_catalog_model_csv_markup
    text += self._get_catalog_csv_markup(context, planid, components, 0, None, '', custom_ctx, separator, include_status, fulldetails, raw_wiki_format)
  File "/usr/local/lib/python2.7/dist-packages/TestManager-1.6.2-py2.7.egg/testmanager/api.py", line 1525, in _get_catalog_csv_markup
    text += self._get_testcases_csv_markup(context, planid, cmtData, level+1, tp, tcat_id, custom_ctx, separator, include_status, fulldetails, raw_wiki_format)
  File "/usr/local/lib/python2.7/dist-packages/TestManager-1.6.2-py2.7.egg/testmanager/api.py", line 1615, in _get_testcases_csv_markup
    description = self._get_object_description(tc.description, raw_wiki_format, context)
  File "/usr/local/lib/python2.7/dist-packages/TestManager-1.6.2-py2.7.egg/testmanager/api.py", line 1665, in _get_object_description
    f.format(wikidom, out, False)
  File "/usr/local/lib/python2.7/dist-packages/Trac-0.12.5-py2.7.egg/trac/wiki/formatter.py", line 1243, in format
    result = re.sub(self.wikiparser.rules, self.replace, line)
  File "/usr/lib/python2.7/re.py", line 151, in sub
    return _compile(pattern, flags).sub(repl, string, count)
  File "/usr/local/lib/python2.7/dist-packages/Trac-0.12.5-py2.7.egg/trac/wiki/formatter.py", line 1161, in replace
    replacement = self.handle_match(fullmatch)
  File "/usr/local/lib/python2.7/dist-packages/Trac-0.12.5-py2.7.egg/trac/wiki/formatter.py", line 1154, in handle_match
    return external_handler(self, match, fullmatch)
  File "/usr/local/lib/python2.7/dist-packages/Trac-0.12.5-py2.7.egg/trac/wiki/api.py", line 303, in wikipagename_link
    self.ignore_missing_pages, match)
  File "/usr/local/lib/python2.7/dist-packages/Trac-0.12.5-py2.7.egg/trac/wiki/api.py", line 361, in _format_link
    pagename = self._resolve_scoped_name(pagename, referrer)
  File "/usr/local/lib/python2.7/dist-packages/Trac-0.12.5-py2.7.egg/trac/wiki/api.py", line 394, in _resolve_scoped_name
    referrer = referrer.split('/')
AttributeError: 'NoneType' object has no attribute 'split'
2013-06-04 17:33:20,014 Trac[trac:chrome] DEBUG: Prepare chrome data for request
2013-06-04 17:33:20,235 Trac[trac:main] DEBUG: Dispatching <Request "GET '/chrome/site/your_project_logo.png'">
2013-06-04 17:33:20,236 Trac[trac:chrome] WARNING: File your_project_logo.png not found in any of ['/var/trac/htdocs']
2013-06-04 17:33:20,236 Trac[trac:main] WARNING: HTTPNotFound: 404 Not Found (File your_project_logo.png not found)
2013-06-04 17:33:20,237 Trac[trac:session] DEBUG: Retrieving session for ID 'f6cbeb2ec1b214414a8bd75a'
2013-06-04 17:33:20,237 Trac[trac:chrome] DEBUG: Prepare chrome data for request

Attachments (2)

trac - Internal Error – ExtraHop.html.mht.gz (19.4 KB) - added by Roberto Longobardi 11 years ago.
Trac error page
api.py (68.7 KB) - added by Roberto Longobardi 11 years ago.
Patched api.py file

Download all attachments as: .zip

Change History (10)

comment:1 Changed 11 years ago by Roberto Longobardi

Status: newassigned

Hi jtmon, I've tried to reproduce this error, but unfortunately couldn't, neither with empty catalog titles, or descriptions, or with non-ASCII characters.

I've used Trac 0.12.4 and Trac 1.0.1.

Please, could you try to narrow down which is the test catalog causing the problem and copy/paste the title and description here?

Thanks, ciao. Roberto

comment:2 in reply to:  1 Changed 11 years ago by jtmoon@…

Replying to seccanj:

Please, could you try to narrow down which is the test catalog causing the problem and copy/paste the title and description here?

Test Catalog is top-level. tcat_title: u'Release 3.9' description: u'"<p>\nsome description\n</p>\n"'

From the exception, referrer is None. Looking at the code, referrer comes from formatter.resource.id (see def _format_link) . It appears formatter.resource.id corresponds to the name column from table wiki. However, there are no blank name rows.

I've attached a detailed exception dump.

comment:3 Changed 11 years ago by JamesThomasMoon1979

It looks like the exception dump keeps getting rejected (first rejected as spam, second time I attached the gzipped version which was rejeced with a write error). Anyway, I'll email it to you.

comment:4 in reply to:  3 Changed 11 years ago by Ryan J Ollos

Replying to JamesThomasMoon1979:

It looks like the exception dump keeps getting rejected (first rejected as spam, second time I attached the gzipped version which was rejected with a write error).

We've just upgraded the site, and it's not possible to add or view attachments at the moment due to a failed update step (#11151). That should be fixed in the next day or so. After that is fixed, if attachments continue to be rejected as spam, please let me know because the spam filter may need some tuning.

comment:5 Changed 11 years ago by Roberto Longobardi

Hi Thomas,

Attached is the detailed python exception dump with local frame variables. Hope this helps.

I've attached the file you sent to this ticket.

Unfortunately, I still cant reproduce the problem, even trying to replicate your environment.

I see from the log file that you have defined custom fields for test catalogs, test cases, plans and test cases in a plan. There may be other customizations I can't recognize, so it would help if you could send me your trac.db and trac.ini, so that I can debug your exact problem.

Also, do you know if TestManagerForTracPlugin will be available for trac 1.0 ? Is there a timeline for that?

The plugin is already compatible with Trac 1.0.x (since 1.5.2) !!! Enjoy your Trac upgrade :)

Ciao, Roberto

Last edited 11 years ago by Ryan J Ollos (previous) (diff)

Changed 11 years ago by Roberto Longobardi

Trac error page

comment:6 Changed 11 years ago by Roberto Longobardi

Hi Thomas, thanks to the info you sent by email I could debug and resolve this issue.

It was all caused by the "PolPot" sample word in one of your testcases :)

The formatter tried to convert it to a wiki page link and, because it did not exist, throw an error.

This was actually caused by my misusing a Trac api.

You can find the patched api.py file attached to this ticket. Replace the file testman4trac.1.6.2/testman4trac/trunk/testmanager/api.py, rebuild and deploy, and you should be able to export your test catalogs without any problems.

Let me know if it works.

Ciao, Roberto

Changed 11 years ago by Roberto Longobardi

Attachment: api.py added

Patched api.py file

comment:7 Changed 11 years ago by Roberto Longobardi

Fixed with 1.7.1

comment:8 Changed 11 years ago by Roberto Longobardi

Resolution: fixed
Status: assignedclosed

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.