Ticket #6833 (closed task: fixed)

Opened 3 years ago

Last modified 3 years ago

AttributeError: 'NoneType' object has no attribute 'startswith'

Reported by: PontusCarlsson@live.se Assigned to: exarv
Priority: high Component: PhpdocPlugin
Severity: critical Keywords:
Cc: Trac Release: 0.11

Description

html_output = Option('phpdoc', 'html_output', None, at line 50 should be: html_output = Option('phpdoc', 'html_output', , instead

If [phpdoc] html_output = isn't set then the plugin will fail with the error message "AttributeError?: 'NoneType?' object has no attribute 'startswith'" because of that process_request on line 159 tries to access a String method on a NoneType?.

Attachments

Change History

(in reply to: ↑ description ) 03/29/10 16:49:38 changed by mathdesc@scourge.biz

  • priority changed from normal to high.
  • severity changed from normal to critical.

Replying to PontusCarlsson@live.se:

html_output = Option('phpdoc', 'html_output', None, at line 50 should be: html_output = Option('phpdoc', 'html_output', , instead If [phpdoc] html_output = isn't set then the plugin will fail with the error message "AttributeError?: 'NoneType?' object has no attribute 'startswith'" because of that process_request on line 159 tries to access a String method on a NoneType?.

Is the "should be" statement above a valid resolution to this ? My trac.log says :

 Trac[main] ERROR: Internal Server Error: 
Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/Trac-0.11.7-py2.4.egg/trac/web/main.py", line 450, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib/python2.4/site-packages/Trac-0.11.7-py2.4.egg/trac/web/main.py", line 206, in dispatch
    resp = chosen_handler.process_request(req)
  File "build/bdist.linux-x86_64/egg/phpdoctrac/phpdoctrac.py", line 159, in process_request
  File "/usr/lib64/python2.4/posixpath.py", line 60, in join
    if b.startswith('/'):
AttributeError: 'NoneType' object has no attribute 'startswith'

As yours I guess and indeed that's line 159. I am not familiar with python's egg : did you try out to patch the line and make it work ?

If not and as I'm not able to fix this : is there a way to deactivate a piece of the functionality to make PHPDoc work ?

Mathdesc

03/29/10 18:00:31 changed by PontusCarlsson@live.se

Yes, my "Should be" patch works flawless. I've been using this egg stable since I've posted this patch and everything works.

If maybe the author of this plugin could look over here could perhaps commit an updated version of the code.

(follow-up: ↓ 4 ) 03/29/10 21:06:40 changed by mathdesc@scourge.biz

Sure exarv should read this thread !

Meanwhile it happens, may I ask you how you did patch the original egg or if you could attach your patched egg ? I did find litterature on how to cook eggs from source, but can't find anything for "the other way round"...

Tack bra!

(in reply to: ↑ 3 ) 03/29/10 21:20:15 changed by anonymous

  • type changed from defect to task.

Replying to mathdesc@scourge.biz:

Sure exarv should read this thread ! Meanwhile it happens, may I ask you how you did patch the original egg or if you could attach your patched egg ? I did find litterature on how to cook eggs from source, but can't find anything for "the other way round"... Tack bra!

Self-reply :) 0.svn co http://trac-hacks.org/svn/phpdocplugin/0.11/ 1.edit & correct phpdoctrac.py 2.python setup.py bdist_egg 3.copy where to...

Testing in production tomorrow.

03/29/10 21:49:40 changed by exarv

Yes, I'm reading it. But very busy at work at the last weeks, euh. months. I'l try to apply the patch tomorrow and post the new version into svn

03/29/10 21:49:46 changed by exarv

  • status changed from new to assigned.

03/30/10 13:43:07 changed by PontusCarlsson@live.se

Yes, that's the way to do it. Thanks exarv :)

03/30/10 16:41:07 changed by exarv

(In [7799]) re #6833 - Changed None to an empty string

(follow-up: ↓ 10 ) 03/30/10 16:45:18 changed by exarv

  • status changed from assigned to closed.
  • resolution set to fixed.

Requested change implemented

(in reply to: ↑ 9 ) 03/31/10 10:52:47 changed by anonymous

Replying to exarv:

Requested change implemented

Be thanked, exarv, this hack is very handy. (BTW I've add the easy_install way to installation instructions.)


Add/Change #6833 (AttributeError: 'NoneType' object has no attribute 'startswith')




Change Properties
Action