RE: [Zope] Wrong mime type sent by Zope on every page
But what if there are side effects to calling the document? What should happen? I don't want a counter to go up or anything just because a HEAD was called on the object.
This is not as black-and-white and simple an issue.
The web is an imperfect medium, but returning a junk content type isn't good.
I'll throw out a proposal on this. It also is not perfect, but seems to strike a happier balance. When HEAD is called on an object, what currently happens is: if a 'content_type' attribute exists, it is used else if the object's id seems to have a file extension (. in the id), try to use guess_content_type else fall back to the hated application/octet-stream (or, I've seen x-unknown-content-type used before, but I don't know if this is really any better). What if we change this to: if a 'content_type' attribute exists, it is used else if the object's id seems to have a file extension (. in the id), try to use guess_content_type
else if there is a 'default_content_type' attribute, use that
else fall back to the hated application/octet-stream (or, I've seen x-unknown-content-type used before, but I don't know if this is really any better). Then we could put a 'default_content_type' attribute in the class of dtml documents and methods, which would take care of the most common case. Thoughts? Brian Lloyd brian@digicool.com Software Engineer 540.371.6909 Digital Creations http://www.digicool.com
Brian Lloyd writes:
What if we change this to:
if a 'content_type' attribute exists, it is used
else if the object's id seems to have a file extension (. in the id), try to use guess_content_type
else if there is a 'default_content_type' attribute, use that
else fall back to the hated application/octet-stream (or, I've seen x-unknown-content-type used before, but I don't know if this is really any better).
Then we could put a 'default_content_type' attribute in the class of dtml documents and methods, which would take care of the most common case. Thoughts?
Sounds pretty good. Setting 'default_content_type' can then be another item in the unwritten Guide to Writing a Zope Product.
"Dan L. Pierson" wrote:
Sounds pretty good. Setting 'default_content_type' can then be another item in the unwritten Guide to Writing a Zope Product.
Well, hopefully this will actually get written sometime and we can all stop scratching our heads everytime we want to know how to do something. ...that, or hacking it till it works and finding the thing we used was being deprecated in the next point release... ;-) cheers, Chris
Brian Lloyd wrote:
What if we change this to:
if a 'content_type' attribute exists, it is used
else if the object's id seems to have a file extension (. in the id), try to use guess_content_type
else if there is a 'default_content_type' attribute, use that
It would be cool if this could be acquired :-)
else fall back to the hated application/octet-stream (or, I've seen x-unknown-content-type used before, but I don't know if this is really any better).
Then we could put a 'default_content_type' attribute in the class of dtml documents and methods, which would take care of the most common case. Thoughts?
Looks great otherwise :-) Chris
participants (3)
-
Brian Lloyd -
Chris Withers -
Dan L. Pierson