Re: [Zope-dev] redirect burps on unicode URLs
On 2/25/10 17:08 , Tres Seaver wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Adam GROSZER wrote: Hello, Looks like zope.publisher burps on unicode URL which contain non-ascii chars. This is from a KGS 3.4 application, but looking at the source it still seems to have the same problems. opinions? ... self.request.response.redirect(url) File d:\home\.buildout\eggs\zope.publisher-3.4.6-py2.5.egg\zope\publisher\browser.py, line 729, in redirect return super(BrowserResponse, self).redirect(location, status) File d:\home\.buildout\eggs\zope.publisher-3.4.6-py2.5.egg\zope\publisher\http.py, line 882, in redirect self.setHeader('Location', location) File d:\home\.buildout\eggs\zope.publisher-3.4.6-py2.5.egg\zope\publisher\http.py, line 676, in setHeader value = str(value) UnicodeEncodeError: 'ascii' codec can't encode character u'\xd6' in position 71: ordinal not in range(128) Two issues: - - Technically there is no such thing as a unicode URL: URLs are always ASCII, with other characters encoded[1]. IRIs and IRLs are a different thing altogether. I see this as naming confusion. In this day and age every URL is effectively an IRI, and every modern browser treats them that way. If you look at http://jp.wikipedia.org/ you can see how well that works. I do not see why zope.publisher should not be able to support that transparently. Other systems such as Routes and repoze.bfg do. Wichert. ___ 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] Zope Tests: 6 OK
Summary of messages to the zope-tests list. Period Thu Feb 25 12:00:00 2010 UTC to Fri Feb 26 12:00:00 2010 UTC. There were 6 messages: 6 from Zope Tests. Tests passed OK --- Subject: OK : Zope-2.10 Python-2.4.6 : Linux From: Zope Tests Date: Thu Feb 25 20:36:26 EST 2010 URL: http://mail.zope.org/pipermail/zope-tests/2010-February/013635.html Subject: OK : Zope-2.11 Python-2.4.6 : Linux From: Zope Tests Date: Thu Feb 25 20:38:26 EST 2010 URL: http://mail.zope.org/pipermail/zope-tests/2010-February/013636.html Subject: OK : Zope-2.12 Python-2.6.4 : Linux From: Zope Tests Date: Thu Feb 25 20:40:26 EST 2010 URL: http://mail.zope.org/pipermail/zope-tests/2010-February/013637.html Subject: OK : Zope-2.12-alltests Python-2.6.4 : Linux From: Zope Tests Date: Thu Feb 25 20:42:26 EST 2010 URL: http://mail.zope.org/pipermail/zope-tests/2010-February/013638.html Subject: OK : Zope-trunk Python-2.6.4 : Linux From: Zope Tests Date: Thu Feb 25 20:44:26 EST 2010 URL: http://mail.zope.org/pipermail/zope-tests/2010-February/013639.html Subject: OK : Zope-trunk-alltests Python-2.6.4 : Linux From: Zope Tests Date: Thu Feb 25 20:46:26 EST 2010 URL: http://mail.zope.org/pipermail/zope-tests/2010-February/013640.html ___ 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] z3c.form vs. Invalid exceptions
Hi, The z3c.form doctests make it look like raising zope.interface.Invalid() would be an acceptable thing for a validator to do. It also makes it look like the argument passed to the Invalid() constructor is a string that would be displayed as an error message. However, when I do this (in a constraint or a IValidator adapter), the exception is not caught, and so causes a traceback. In field.py, we have:: try: widget.setErrors = self.setErrors raw = widget.extract() if raw is not interfaces.NO_VALUE: value = interfaces.IDataConverter(widget).toFieldValue(raw) zope.component.getMultiAdapter( (self.content, self.request, self.form, getattr(widget, 'field', None), widget), interfaces.IValidator).validate(value) except (zope.schema.ValidationError, ValueError, MultipleErrors), error: view = zope.component.getMultiAdapter( (error, self.request, widget, widget.field, self.form, self.content), interfaces.IErrorViewSnippet) view.update() if self.setErrors: widget.error = view errors += (view,) And indeed, this doesn't catch Invalid. In error.py, on the other hand, there is an InvalidErrorViewSnippet. Is this intentional? Martin -- Author of `Professional Plone Development`, a book for developers who want to work with Plone. See http://martinaspeli.net/plone-book ___ 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] z3c.form vs. Invalid exceptions
On Friday 26 February 2010, Martin Aspeli wrote: The z3c.form doctests make it look like raising zope.interface.Invalid() would be an acceptable thing for a validator to do. It also makes it look like the argument passed to the Invalid() constructor is a string that would be displayed as an error message. After reviewing the code and comments briefly, I think this is a bug. I am amazed that it has not surfaced before. I guess Invalid from zope.interface is simply not raised that often. Feel free to fix the bug with a test. You can also release a new z3c.form version if you like. I can give you access Regards, Stephan -- Entrepreneur and Software Geek Google me. Zope Stephan Richter ___ 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] redirect burps on unicode URLs
Hello, Some background: This arises when you try to access a url which has non-ascii in it (but is well encoded), usually a document uploaded by a user. Then the loginform comes with it's camefrom parameter. On successful login yo uget redirected to the camefrom url, which gets unencoded to unicode, that's where it burps (for me). Do we want to fix this? Which part is bogus? The loginform with it's redirect or the redirect itself? Friday, February 26, 2010, 9:29:54 AM, you wrote: WA On 2/25/10 17:08 , Tres Seaver wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Adam GROSZER wrote: Hello, Looks like zope.publisher burps on unicode URL which contain non-ascii chars. This is from a KGS 3.4 application, but looking at the source it still seems to have the same problems. opinions? ... self.request.response.redirect(url) File d:\home\.buildout\eggs\zope.publisher-3.4.6-py2.5.egg\zope\publisher\browser.py, line 729, in redirect return super(BrowserResponse, self).redirect(location, status) File d:\home\.buildout\eggs\zope.publisher-3.4.6-py2.5.egg\zope\publisher\http.py, line 882, in redirect self.setHeader('Location', location) File d:\home\.buildout\eggs\zope.publisher-3.4.6-py2.5.egg\zope\publisher\http.py, line 676, in setHeader value = str(value) UnicodeEncodeError: 'ascii' codec can't encode character u'\xd6' in position 71: ordinal not in range(128) Two issues: - - Technically there is no such thing as a unicode URL: URLs are always ASCII, with other characters encoded[1]. IRIs and IRLs are a different thing altogether. WA I see this as naming confusion. In this day and age every URL is WA effectively an IRI, and every modern browser treats them that way. If WA you look at http://jp.wikipedia.org/ you can see how well that works. I WA do not see why zope.publisher should not be able to support that WA transparently. Other systems such as Routes and repoze.bfg do. WA Wichert. WA ___ WA Zope-Dev maillist - Zope-Dev@zope.org WA https://mail.zope.org/mailman/listinfo/zope-dev WA ** No cross posts or HTML encoding! ** WA (Related lists - WA https://mail.zope.org/mailman/listinfo/zope-announce WA https://mail.zope.org/mailman/listinfo/zope ) -- Best regards, Adam GROSZERmailto:agros...@gmail.com -- Quote of the day: Do not make friends who are comfortable to be with. Make friends who will force you to lever yourself up. - Thomas J. Watson, Sr. ___ 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] z3c.form vs. Invalid exceptions
Stephan Richter wrote: On Friday 26 February 2010, Martin Aspeli wrote: The z3c.form doctests make it look like raising zope.interface.Invalid() would be an acceptable thing for a validator to do. It also makes it look like the argument passed to the Invalid() constructor is a string that would be displayed as an error message. After reviewing the code and comments briefly, I think this is a bug. I am amazed that it has not surfaced before. I guess Invalid from zope.interface is simply not raised that often. Feel free to fix the bug with a test. You can also release a new z3c.form version if you like. I can give you access Fixed. I also added the behaviour to not render anything for a non-200 request. My PyPI username is optilude if you'd like me to release it a 2.3.3. Martin -- Author of `Professional Plone Development`, a book for developers who want to work with Plone. See http://martinaspeli.net/plone-book ___ 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] redirect burps on unicode URLs
On 02/26/2010 04:12 PM, Adam GROSZER wrote: Hello, Some background: This arises when you try to access a url which has non-ascii in it (but is well encoded), usually a document uploaded by a user. Then the loginform comes with it's camefrom parameter. On successful login yo uget redirected to the camefrom url, which gets unencoded to unicode, that's where it burps (for me). Do we want to fix this? Yes, please. Which part is bogus? The loginform with it's redirect or the redirect itself? According to the RFC Tres referenced we can't just represent a URL as a unicode string but would have to deal with the schemes' structure and specific encoding issues. To support the round-trip issue, one way that I can see would be to use a specific URL object instead of a unicode string. That would be quite a change, but we could probably make it work in a backwards compatible way. Other suggestions? Christian -- Christian Theune · c...@gocept.com gocept gmbh co. kg · forsterstraße 29 · 06112 halle (saale) · germany http://gocept.com · tel +49 345 1229889 0 · fax +49 345 1229889 1 Zope and Plone consulting and development ___ 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] z3c.form vs. Invalid exceptions
On 02/26/2010 04:23 PM, Martin Aspeli wrote: Stephan Richter wrote: On Friday 26 February 2010, Martin Aspeli wrote: The z3c.form doctests make it look like raising zope.interface.Invalid() would be an acceptable thing for a validator to do. It also makes it look like the argument passed to the Invalid() constructor is a string that would be displayed as an error message. After reviewing the code and comments briefly, I think this is a bug. I am amazed that it has not surfaced before. I guess Invalid from zope.interface is simply not raised that often. Feel free to fix the bug with a test. You can also release a new z3c.form version if you like. I can give you access Fixed. I also added the behaviour to not render anything for a non-200 request. Yay! -- Christian Theune · c...@gocept.com gocept gmbh co. kg · forsterstraße 29 · 06112 halle (saale) · germany http://gocept.com · tel +49 345 1229889 0 · fax +49 345 1229889 1 Zope and Plone consulting and development ___ 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] z3c.form vs. Invalid exceptions
On Friday 26 February 2010, Martin Aspeli wrote: Feel free to fix the bug with a test. You can also release a new z3c.form version if you like. I can give you access Fixed. I also added the behaviour to not render anything for a non-200 request. My PyPI username is optilude if you'd like me to release it a 2.3.3. Thanks for your work. I gave you access to z3c.form, z3c.formui and z3c.formdemo, which are all related. Regards, Stephan -- Entrepreneur and Software Geek Google me. Zope Stephan Richter ___ 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] redirect burps on unicode URLs
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Wichert Akkerman wrote: On 2/25/10 17:08 , Tres Seaver wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Adam GROSZER wrote: Hello, Looks like zope.publisher burps on unicode URL which contain non-ascii chars. This is from a KGS 3.4 application, but looking at the source it still seems to have the same problems. opinions? ... self.request.response.redirect(url) File d:\home\.buildout\eggs\zope.publisher-3.4.6-py2.5.egg\zope\publisher\browser.py, line 729, in redirect return super(BrowserResponse, self).redirect(location, status) File d:\home\.buildout\eggs\zope.publisher-3.4.6-py2.5.egg\zope\publisher\http.py, line 882, in redirect self.setHeader('Location', location) File d:\home\.buildout\eggs\zope.publisher-3.4.6-py2.5.egg\zope\publisher\http.py, line 676, in setHeader value = str(value) UnicodeEncodeError: 'ascii' codec can't encode character u'\xd6' in position 71: ordinal not in range(128) Two issues: - - Technically there is no such thing as a unicode URL: URLs are always ASCII, with other characters encoded[1]. IRIs and IRLs are a different thing altogether. I see this as naming confusion. In this day and age every URL is effectively an IRI, and every modern browser treats them that way. If you look at http://jp.wikipedia.org/ you can see how well that works. I do not see why zope.publisher should not be able to support that transparently. Other systems such as Routes and repoze.bfg do. Browseers *display* what looks like unicode to the user, but they *pass* URL-encoded ASCII bytes to the server. Even if that weren't so, HTTP header values (the 'Location:' header, in this case) still have to be ASCII, period. Tres. - -- === Tres Seaver +1 540-429-0999 tsea...@palladion.com Palladion Software Excellence by Designhttp://palladion.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkuIA/QACgkQ+gerLs4ltQ72NwCgu9No4P4J5y29kiTJk124GYZ2 PhYAnjNhssCzpFgNaMmL2c3Y1wVEzeKJ =4HgE -END PGP SIGNATURE- ___ 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] SVN: Zope/branches/2.12/src/Products/Five/browser/absoluteurl.py Fix _getContextName; does anyone test this stuff?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Martijn Pieters wrote: Log message for revision 109473: Fix _getContextName; does anyone test this stuff? Changed: U Zope/branches/2.12/src/Products/Five/browser/absoluteurl.py -=- Modified: Zope/branches/2.12/src/Products/Five/browser/absoluteurl.py === --- Zope/branches/2.12/src/Products/Five/browser/absoluteurl.py 2010-02-26 15:23:23 UTC (rev 109472) +++ Zope/branches/2.12/src/Products/Five/browser/absoluteurl.py 2010-02-26 16:46:18 UTC (rev 109473) @@ -62,7 +62,7 @@ def _getContextName(self, context): if getattr(context, 'getId', None) is not None: return context.getId() -getattr(context, '__name__', None) +return getattr(context, '__name__', None) def breadcrumbs(self): context = self.context Kettle to pot: Did you add a test? Tres. - -- === Tres Seaver +1 540-429-0999 tsea...@palladion.com Palladion Software Excellence by Designhttp://palladion.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkuIBUEACgkQ+gerLs4ltQ6wLQCgjoILR7DEUSnX8cP6RrMFyZuo ZyYAoLheP2E352KlZJA77fLcDRrfIiU5 =ATl+ -END PGP SIGNATURE- ___ 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] SVN: Zope/branches/2.12/src/Products/Five/browser/absoluteurl.py Fix _getContextName; does anyone test this stuff?
2010/2/26 Tres Seaver tsea...@palladion.com: Kettle to pot: Did you add a test? I ran out of time; the current tests weren't easily molded to add a case for this. I felt that at least the simple 'return' statement fix should go in. I'll get the test case in this weekend, hopefully. -- Martijn Pieters ___ 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 )