Modify

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#6833 closed task (fixed)

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

Reported by: PontusCarlsson@… Owned by: 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 (0)

Change History (10)

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

  • 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

comment:2 Changed 4 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: Changed 4 years ago by mathdesc@…

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!

comment:4 in reply to: ↑ 3 Changed 4 years ago 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.

comment:5 Changed 4 years ago 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

comment:6 Changed 4 years ago by exarv

  • Status changed from new to assigned

comment:7 Changed 4 years ago by PontusCarlsson@…

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

comment:8 Changed 4 years ago by exarv

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

comment:9 follow-up: Changed 4 years ago by exarv

  • Resolution set to fixed
  • Status changed from assigned to closed

Requested change implemented

comment:10 in reply to: ↑ 9 Changed 4 years ago 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 Comment

Modify Ticket

Action
as closed .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from exarv. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.