Ticket #310 (closed defect: fixed)

Opened 3 years ago

Last modified 18 months ago

HTTPHeader object has no attribute 'remove'

Reported by: junya Owned by: ianb
Priority: high Milestone: 1.4.1
Component: paste Version: svn-trunk
Severity: critical Keywords:
Cc:

Description

  • self.remove(collection) + self.delete(collection)

When guessing mymetypes is failed, it makes critical error.

Change History

Changed 3 years ago by knzm

And it seems module's docstring should be fixed.

It says:

delete(collection)

This method removes all entries of the corresponding header from the given collection (environ or response_headers), e.g., USER_AGENT.remove(environ) deletes the 'HTTP_USER_AGENT' entry from the environ.

but, I got:

>>> environ = {}
>>> from paste.httpheaders import USER_AGENT
>>> USER_AGENT.remove(environ)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: '_SingleValueHeader' object has no attribute 'remove'

Changed 3 years ago by knzm

  • summary changed from httpheaders.py line:462 is wrong to HTTPHeader object has no attribute 'remove'

I can reproduce the issue by the following procedure:

>>> headers={}
>>> from paste.httpheaders import *
>>> CONTENT_TYPE.update(headers, "")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/nozom/work/pyxis/lib/python2.5/site-packages/Paste-1.7.1-py2.5.egg/paste/httpheaders.py", line 462, in update
    self.remove(collection)
AttributeError: '_ContentType' object has no attribute 'remove'
>>> 

Changed 18 months ago by ianb

  • status changed from new to closed
  • resolution set to fixed

Fixed in 1473:7d616191fc51

Note: See TracTickets for help on using tickets.