Opened 8 years ago

Closed 8 years ago

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

Reported by: Owned by: PontusCarlsson@… Robert Verspuy high PhpdocPlugin critical 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.

comment:1 in reply to:  description Changed 8 years ago by mathdesc@…

Priority: normal → high normal → critical

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

comment:2 Changed 8 years ago by PontusCarlsson@…

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.

comment:3 follow-up:  4 Changed 8 years ago by mathdesc@…

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!

comment:4 in reply to:  3 Changed 8 years ago by anonymous

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.

comment:5 Changed 8 years ago by Robert Verspuy

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

comment:6 Changed 8 years ago by Robert Verspuy

Status: new → assigned

comment:7 Changed 8 years ago by PontusCarlsson@…

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

comment:8 Changed 8 years ago by Robert Verspuy

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

comment:9 follow-up:  10 Changed 8 years ago by Robert Verspuy

Resolution: → fixed assigned → closed

Requested change implemented

comment:10 in reply to:  9 Changed 8 years ago by anonymous

Requested change implemented

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

Modify Ticket

Change Properties