Re: [Zope-dev] broken zope.publisher because of new content types in zope.contenttype
On Sat, Jan 2, 2010 at 5:17 AM, Roger d...@projekt01.ch wrote: Hi all Since aaron added new mimetypes e.g. application/javascript, the _implicitResult method in zope.publisher.http.py (line 794) is broken because the method checks for text/* content types if unicode is given: def _implicitResult(self, body): encoding = getCharsetUsingRequest(self._request) or 'utf-8' content_type = self.getHeader('content-type') if isinstance(body, unicode): try: if not content_type.startswith('text/'): raise ValueError( 'Unicode results must have a text content type.') except AttributeError: raise ValueError( 'Unicode results must have a text content type.') I changed the mime-type for .js from application/x-javascript to application/javascript. Since I didn't change any text/* mime-types, I'm not seeing how my change could be breaking anything that wasn't already broken. The tests for zope.publisher run fine for me with my changes, anyway. Can you tell how to reproduce the breakage? Sould we remove this basic content type check above? Or enhance the check with the new added unicode valid content types like application/javascript. Since whatever code is breaking for you now probably was breaking before (since it was passing in application/x-javascript, which is also not a text/* type), I'm inclined to think that your problem is at a higher level. btw, the RFC is just Informational which defines this changes. See: http://www.rfc-editor.org/rfc/rfc4329.txt According to the link above, the status of the following are: text/javascript obsolete application/x-javascript discouraged application/javascript intended for common use, should be used Aaron Lehmann ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] broken zope.publisher because of new content types in zope.contenttype
Hi Aaron Betreff: Re: [Zope-dev] broken zope.publisher because of new content types in zope.contenttype On Sat, Jan 2, 2010 at 5:17 AM, Roger d...@projekt01.ch wrote: Hi all Since aaron added new mimetypes e.g. application/javascript, the _implicitResult method in zope.publisher.http.py (line 794) is broken because the method checks for text/* content types if unicode is given: def _implicitResult(self, body): encoding = getCharsetUsingRequest(self._request) or 'utf-8' content_type = self.getHeader('content-type') if isinstance(body, unicode): try: if not content_type.startswith('text/'): raise ValueError( 'Unicode results must have a text content type.') except AttributeError: raise ValueError( 'Unicode results must have a text content type.') I changed the mime-type for .js from application/x-javascript to application/javascript. Since I didn't change any text/* mime-types, I'm not seeing how my change could be breaking anything that wasn't already broken. The tests for zope.publisher run fine for me with my changes, anyway. Can you tell how to reproduce the breakage? Sould we remove this basic content type check above? Or enhance the check with the new added unicode valid content types like application/javascript. Since whatever code is breaking for you now probably was breaking before (since it was passing in application/x-javascript, which is also not a text/* type), I'm inclined to think that your problem is at a higher level. You are absolutly right. It's not your fault and I'm fine with your changes. I also posted already a mail with more infos. Sorry about that! I'm still confused because I can't find the changes which makes my custom and the z3c.zrtresouce package break. I think this is because of some missing zcml includes which are gone during refactoring zope.app.* to zope.* packages. Some refactoring left over a couple of configurations in the zope.app.* package which are gone now in my setup and probably others project setup. I'm fine right now and fixed my custom package. Let me know if someone else runs into the same problem and I can backport the fix to the z3c.zrtresource package. Regards Roger Ineichen ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] broken zope.publisher because of new content types in zope.contenttype
Hey, Roger wrote: Since aaron added new mimetypes e.g. application/javascript, the _implicitResult method in zope.publisher.http.py (line 794) is broken because the method checks for text/* content types if unicode is given: def _implicitResult(self, body): encoding = getCharsetUsingRequest(self._request) or 'utf-8' content_type = self.getHeader('content-type') if isinstance(body, unicode): try: if not content_type.startswith('text/'): raise ValueError( 'Unicode results must have a text content type.') except AttributeError: raise ValueError( 'Unicode results must have a text content type.') Sould we remove this basic content type check above? Or enhance the check with the new added unicode valid content types like application/javascript. btw, the RFC is just Informational which defines this changes. See: http://www.rfc-editor.org/rfc/rfc4329.txt We don't seem to be getting test failures anywhere in the ZTK. Could you propose a test that identifies this issue? Aaron, can you give feedback about this issue? Regards, Martijn ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] broken zope.publisher because of new content types in zope.contenttype
Hi all Since aaron added new mimetypes e.g. application/javascript, the _implicitResult method in zope.publisher.http.py (line 794) is broken because the method checks for text/* content types if unicode is given: def _implicitResult(self, body): encoding = getCharsetUsingRequest(self._request) or 'utf-8' content_type = self.getHeader('content-type') if isinstance(body, unicode): try: if not content_type.startswith('text/'): raise ValueError( 'Unicode results must have a text content type.') except AttributeError: raise ValueError( 'Unicode results must have a text content type.') Sould we remove this basic content type check above? Or enhance the check with the new added unicode valid content types like application/javascript. btw, the RFC is just Informational which defines this changes. See: http://www.rfc-editor.org/rfc/rfc4329.txt Regards Roger Ineichen _ END OF MESSAGE ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )