Re: AW: [Zope-dev] Access problem.
On Wednesday 25 September 2002 20:34, you wrote: -- I am developing a CMF link product which defines its own traverse method: def __bobo_traverse__(self, request, name=None): Traverse method hook if hasattr(self, name): # return own attributes/subobjects return getattr(self, name) else: t= self.getTarget() if hasattr(t, name): # return target's attributes/subobjects return getattr(t, name) else: return t -- It works fine under the ZMI but when I try to access an object of this product into a CMF portal using the CMF interface, Zope requests me login name and password (even if I am admin!!), which it doesn't accept, so the only way to continue is to cancel instead of triying to log in. I had a similar problem when accessing the request object in __bobo_traverse__(self, request, name). Authentication didn´t work afterwards. I don´t what happens in getTarget() but maybe that´s the problem. Arndt I don't thing the poblem is in getTarget() because when the exception is thrown that method is never called. The exception is thrown when __bobo_traverse__ returns getattr(linkObject, 'portal_url') and only when we are working with links in the CMF interface, not the ZMI. Any suggestions/questions? Kind regards. ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Unicode Diffs
On Wednesday 25 Sep 2002 6:24 pm, Andreas Jung wrote: How do your patches compare to the unicode extensions made by Toby Dickenson for Zope 2.6? They are built on top of my changes. I did not test this very throughly, but it seems not broken any thing yet. I dont have time to explain your bugs right now, but this patch is horribly broken. I suggest kent sin re-reads the updated docs on Unicode/dtml integration. I think Chris M was integrating them with the main documentation, but the original documatation about the changes is still at: http://www.zope.org/Members/htrd/howto/unicode http://www.zope.org/Members/htrd/howto/unicode-zdg-changes Hint: you should use Unicode string objects inside your published method. Dont work in plain strings and rely on a meta header to tell browsers about the character encoding. Also, think about what character encoding the browser will use for form submissions, and how zope is supposed to know about it. ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
RE: [Zope-dev] Is the aliasing of 'hasRole' correct?
In AccessControl/User.py:: def hasRole(self, *args, **kw): hasRole is an alias for 'allowed' and has been deprecated. Code still using this method should convert to either 'has_role' or 'allowed', depending on the intended behaviour. import warnings warnings.warn('BasicUser.hasRole is deprecated, please use ' 'BasicUser.allowed instead; hasRole was an alias for allowed, but ' 'you may have ment to use has_role.', DeprecationWarning) self.allowed(*args, **kw) Shouldn't that be:: return self.allowed(*args, **kw) Yes, it should. Thanks Jean. I've checked in the fix for this. Brian Lloyd[EMAIL PROTECTED] V.P. Engineering 540.361.1716 Zope Corporation http://www.zope.com ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] [ZOPE 2.6 B1] Unicode/locale problems with OFS/dtml/properties.dtml
We are trying out 2.6 b1. So far it seems very snappy (!!), and the new error-log object is exceptionally usefull! Kudos to Zope Corp and the community. :-) While trying the beta we have found a few problems in the handling of propertysheets. We can successfully store Norwegian characters ('æ','ø', and 'å') in property fields, but when we reload the page, we get results that display wrong. When studying the generated sources, we see that the data from ZOPE inserted into the form is ISO-8859-1. OTOH this field is inserted in the html-header: meta http-equiv=content-type content=text/html;charset=UTF-8 Therefore the browser tries to display utf-8, which of course becomes garbage when you get an ISO-8859-1 character with a larger value than 127. All other pages (than the properies tab) in the have meta http-equiv=content-type content=text/html;charset=ISO-8859-1 Secondly, the type attribute of all inputfields contain an extra ':utf8:' that we assumed is a server directive to interpret the contents as UTF-8. This apperently what crashes when storing the second time. lib/python/OFS/dtml/properties.dtml contains the following that seems to us to be debug code: dtml-call REQUEST.set('management_page_charset','UTF-8') dtml-var u'' and several ':utf8:' directives. When we removed those, it worked fine. Was this dtml-method merged in mistakenly, or are there problems in our setup. Arnar Lundesgaard --- phone: (+47) 982 38 036 mailto:arnar.lundesgaard(at)creuna.no Creuna as Bryggegata 3 NO-0250 Oslo phone office: (+47) 23 23 88 00 fax: (+47) 23 23 88 50 http://www.creuna.no/ ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] [ZOPE 2.6 B1] Unicode/locale problems with OFS/dtml/properties.dtml
On Thursday 26 Sep 2002 4:38 pm, Arnar Lundesgaard wrote: We can successfully store Norwegian characters ('æ','ø', and 'å') in property fields, but when we reload the page, we get results that display wrong. Thats bad. I will definetely resolve this asap. When studying the generated sources, we see that the data from ZOPE inserted into the form is ISO-8859-1. what do you mean by inserted into the form? That the response contains a single byte where you properties contain character whose unicode value is greater than 127 ? how have you checked this? if so, thats a bug. Secondly, the type attribute of all inputfields contain an extra ':utf8:' that we assumed is a server directive to interpret the contents as UTF-8. This apperently what crashes when storing the second time. This is a directive to tell zope when you submit the form that your browser will have encoded the form response using utf-8. Browsers stupidly dont put this information anywhere more suitable. What browser are you using? is it correctly using utf8 for this page? (for example, Mozilla has a View/Encoding menu that can override server-supplied encoding information) lib/python/OFS/dtml/properties.dtml contains the following that seems to us to be debug code: dtml-call REQUEST.set('management_page_charset','UTF-8') dtml-var u'' and several ':utf8:' directives. When we removed those, it worked fine. Was this dtml-method merged in mistakenly Those are supposed to be there. The first inserts the text/html;charset=utf-8 header into the management page. The second ensures that the dtml which computes this page content returns a unicode object. If the dtml returns a unicode object, then ZPublisher looks at the charset header to determine how to encode it. , or are there problems in our setup. could be. please put ib/python/OFS/dtml/properties.dtml back the way is was originally, then send me 1. which browser you are using 2. a export file containing one object that demonstrates the problem. 3. a copy of the page obtained using wget or similar. (please dont use your browsers 'save' feature because that sometimes performs transcoding) ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
RE: [Zope-dev] [ZOPE 2.6 B1] Unicode/locale problems with OFS/dtml/properties.dtml
what do you mean by inserted into the form? Put there by the dtml-method in a dtml-var statement. That the response contains a single byte where you properties contain character whose unicode value is greater than 127 ? Yes how have you checked this? if so, thats a bug. In a Hex editor... The character 'æ' for instance is inserted as '0xE6' in the returned HTML. Secondly, the type attribute of all inputfields contain an extra ':utf8:' that we assumed is a server directive to interpret the contents as UTF-8. This apperently what crashes when storing the second time. This is a directive to tell zope when you submit the form that your browser will have encoded the form response using utf-8. Browsers stupidly dont put this information anywhere more suitable. Yeah, we figured this would be similar to ':method'. What browser are you using? is it correctly using utf8 for this page? (for example, Mozilla has a View/Encoding menu that can override server-supplied encoding information) We have so far tried Opera 6, IE 6 and Mozilla 1.1. lib/python/OFS/dtml/properties.dtml contains the following that seems to us to be debug code: dtml-call REQUEST.set('management_page_charset','UTF-8') dtml-var u'' and several ':utf8:' directives. When we removed those, it worked fine. Was this dtml-method merged in mistakenly Those are supposed to be there. The first inserts the text/html;charset=utf-8 header into the management page. The second ensures that the dtml which computes this page content returns a unicode object. If the dtml returns a unicode object, then ZPublisher looks at the charset header to determine how to encode it. This is DTML/ZOPE internal, right? I though the first two letters to signify endianness 'FFFE' or 'FEFF', tells you that this is UTF-8. The u'' string is not on the firs line. please put ib/python/OFS/dtml/properties.dtml back the way is was originally, then send me 1. which browser you are using I am using Opera 6.02, but we are seeing it on all browsers. 2. a export file containing one object that demonstrates the problem. It is on every property page in the whole site, but see the attached .zexp of /standard_template.pt 3. a copy of the page obtained using wget or similar. (please dont use your browsers 'save' feature because that sometimes performs transcoding) I used wget... -- Arnar Lundesgaard standard_template.pt.zexp Description: standard_template.pt.zexp manage_propertiesForm.1 Description: manage_propertiesForm.1
Re: [Zope-dev] [ZOPE 2.6 B1] Unicode/locale problems with OFS/dtml/properties.dtml
On Thursday 26 Sep 2002 5:47 pm, Arnar Lundesgaard wrote: Thanks for taking the time to help debug this. lib/python/OFS/dtml/properties.dtml contains ... dtml-var u'' This ensures that the dtml which computes this page content returns a unicode object. This line, intended to force the dtml to be rendered as a unicode object, is not doing its job. If the dtml is not a unicode object then ZPublisher's encoding mechanism is not engaged. Has there been some recent dtml optimisation to ignore empty strings perhaps? This patch below works for me. Please let me know if this works for you and I will apply it to 2.6. (and various sources of documentation that all recommend including this line.) Index: properties.dtml === RCS file: /cvs-repository/Zope/lib/python/OFS/dtml/properties.dtml,v retrieving revision 1.8 diff -c -2 -r1.8 properties.dtml *** properties.dtml 7 May 2002 17:54:56 - 1.8 --- properties.dtml 26 Sep 2002 17:54:48 - *** *** 1,4 dtml-call REQUEST.set('management_page_charset','UTF-8') ! dtml-var u'' dtml-var manage_page_header dtml-with _(management_view='Properties') --- 1,4 dtml-call REQUEST.set('management_page_charset','UTF-8') ! dtml-var u' ' dtml-var manage_page_header dtml-with _(management_view='Properties') ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
RE: [Zope-dev] [ZOPE 2.6 B1] Unicode/locale problems with OFS/dtml/properties.dtml
Thanks for taking the time to help debug this. Thanks for fixing it so quickly! This line, intended to force the dtml to be rendered as a unicode object, is not doing its job. If the dtml is not a unicode object then ZPublisher's encoding mechanism is not engaged. Has there been some recent dtml optimisation to ignore empty strings perhaps? This patch below works for me. Please let me know if this works for you and I will apply it to 2.6. (and various sources of documentation that all recommend including this line.) Jepp, that seems to work. I'm at home though, so I haven't been able to try with the original browser configuration. 'wget' gives me UTF-8 though, so it should work nicely. :-) Arnar Lundesgaard ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
RE: [Zope-dev] [ZOPE 2.6 B1] Unicode/locale problems withOFS/dtml/properties.dtml
Am Don, 2002-09-26 um 18.47 schrieb Arnar Lundesgaard: what do you mean by inserted into the form? Put there by the dtml-method in a dtml-var statement. I can second this. With CVS-Zope (did the last cvs up this moment) I'm getting a very curios thing: Displaying .../index_html is ok. But return context.index_html(context,request) creates broken characters instead is isolatin1 Umlaute. In my case (Konqueror on Linux) it seems that the text/html;charset=UTF-8 breaks the page because the byte values are correct for the Umlaute. This is further confirmed by the fact that forcing Konq to display iso8859-1 fixes the display. So how are these Unicode changes supposed to work? Are non-ascii characters forbidden now? And how do I get UTF-8 text into Zope? While I'm quite sure that this will help Zope in the Asiatic region, it seems quite inconvienent for isolatin1 world :( That the response contains a single byte where you properties contain character whose unicode value is greater than 127 ? Yes how have you checked this? if so, thats a bug. In a Hex editor... The character 'æ' for instance is inserted as '0xE6' in the returned HTML. The same here with Umlaute, ... I've used wget and less result to verify that the umlaute display correctly. Andreas -- Andreas Kostyrka [EMAIL PROTECTED] ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
RE: [Zope-dev] [ZOPE 2.6 B1] Unicode/locale problems withOFS/dtml/properties.dtml
I can second this. With CVS-Zope (did the last cvs up this moment) I'm getting a very curios thing: Displaying .../index_html is ok. But return context.index_html(context,request) creates broken characters instead is isolatin1 Umlaute. In my case (Konqueror on Linux) it seems that the text/html;charset=UTF-8 breaks the page because the byte values are correct for the Umlaute. This is further confirmed by the fact that forcing Konq to display iso8859-1 fixes the display. Hmm, you may check out http://collector.zope.org/Zope/517 but it could be the same difficulties as we experienced earlier. The problem here was that Zope thought it was returning UTF-8, while it was really returning ISO-8859-1. This was due to the dtml-var u'' statement not having the desired effect. dtml-var u' ' (notice the space) seemed to work brilliantly. So how are these Unicode changes supposed to work? Are non-ascii characters forbidden now? And how do I get UTF-8 text into Zope? There are converters inside ZOPE. UTF-8 is simply a transport format, although it may be used for storage to save space. There is lots of software that supports UTF-8 today. This is the future. While I'm quite sure that this will help Zope in the Asiatic region, it seems quite inconvienent for isolatin1 world :( This will be a win in Europe as well, especially for multilingual sites. IIRC there are 15 variants of ISO-8859-1. I18N is *very* important, and Unicode is an essential ingredient. Arnar Lundesgaard ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] B0rked my ZODB?
I was happily trying to startup my Zope2.6 instance, running from the Zope-2_6-branch with an ZODB copied from a 2.5 insance and got the following error: 2002-09-26T18:20:07 PANIC(300) z2 Startup exception Traceback (innermost last): Module __main__, line 570, in ? Module string, line 1, in ? Module Zope, line 75, in ? Module OFS.Application, line 342, in initialize Module ZODB.Transaction, line 223, in commit Module ZODB.Transaction, line 195, in commit Module ZODB.Transaction, line 257, in _commit_objects Module ZODB.Connection, line 402, in commit - __traceback_info__: (('Persistence', 'PersistentMapping'), '\x00\x00\x00\x00\x00\x00\x00\x00', '') TypeError: object of type 'list' is not callable Is this something that changed on the last days? It was working with a CVS checkout from 2 days before the 2.6Beta1 release. []'s -- Sidnei da Silva (dreamcatcher) [EMAIL PROTECTED] X3ng Web Technology http://www.x3ng.com.br GNU/Linux user 257852 Debian GNU/Linux 3.0 (Sid) 2.4.18 ppc Those who don't understand Linux are doomed to reinvent it, poorly. -- unidentified source ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] B0rked my ZODB?
Try doing a recompile and restart again. hth, -Casey On Thursday 26 September 2002 05:24 pm, Sidnei da Silva wrote: I was happily trying to startup my Zope2.6 instance, running from the Zope-2_6-branch with an ZODB copied from a 2.5 insance and got the following error: 2002-09-26T18:20:07 PANIC(300) z2 Startup exception Traceback (innermost last): Module __main__, line 570, in ? Module string, line 1, in ? Module Zope, line 75, in ? Module OFS.Application, line 342, in initialize Module ZODB.Transaction, line 223, in commit Module ZODB.Transaction, line 195, in commit Module ZODB.Transaction, line 257, in _commit_objects Module ZODB.Connection, line 402, in commit - __traceback_info__: (('Persistence', 'PersistentMapping'), '\x00\x00\x00\x00\x00\x00\x00\x00', '') TypeError: object of type 'list' is not callable Is this something that changed on the last days? It was working with a CVS checkout from 2 days before the 2.6Beta1 release. []'s -- Sidnei da Silva (dreamcatcher) [EMAIL PROTECTED] X3ng Web Technology http://www.x3ng.com.br GNU/Linux user 257852 Debian GNU/Linux 3.0 (Sid) 2.4.18 ppc Those who don't understand Linux are doomed to reinvent it, poorly. -- unidentified source ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope ) ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] B0rked my ZODB?
On Thu, Sep 26, 2002 at 05:35:25PM -0400, Casey Duncan wrote: | Try doing a recompile and restart again. Oh, what a surprise, it worked :) I should have done this before asking :( Thanx Casey! []'s -- Sidnei da Silva (dreamcatcher) [EMAIL PROTECTED] X3ng Web Technology http://www.x3ng.com.br GNU/Linux user 257852 Debian GNU/Linux 3.0 (Sid) 2.4.18 ppc If a listener nods his head when you're explaining your program, wake him up. ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] Unicode treatment in 2.6b1
Andreas Kostyrka [EMAIL PROTECTED] wrote: So how are these Unicode changes supposed to work? Are non-ascii characters forbidden now? And how do I get UTF-8 text into Zope? If all your code outputs is plain python strings, ZPublisher passes them as-is to the client. If ZPublisher has to output a Unicode string, it has to decide how to translate that into a byte string at the other end. What it does then is encode the Unicode string into the charset defined in any 'Content-Type: text/xxx; charset=thecharset' header you produced using RESPONSE.setHeader (defaulting to latin-1). But how does ZPublisher get a Unicode string in the first place? Well it gets it from the rendering of whatever method was called when publishing the object. For DTML, various blocks are joined together (function render_blocks()), and if one of them happens to be Unicode then the join_unicode method will make it so that all non-Unicode string are converted into Unicode using unicode(s, 'latin-1'). So this assumes that plain strings are encoded in latin-1. Note, WE MAY WANT TO PARAMETRIZE THIS. Basically there could be an additional attribute to the DTML saying what's its native encoding. For PageTemplates, the various blocks produced by the template and python are sent to an StringIO-like objects, which is responsible for converting them into a coherent thing when its getvalue() method is called. At the moment it doesn't deal very well mixed Unicode and non-Unicode strings so the reported failures don't surprise me. WE NEED TO FIX THIS BEFORE THE NEXT BETA, probably also by providing an explicit native encoding. I believe that's what AltPT does. Localizer 0.9, for instance, had the need to patch the StringIO-like object to make it deal with joining non-Unicode and Unicode. Now that I better understand the problem, I'll help fix this ASAP in core Zope. Florent -- Florent Guillaume, Nuxeo (Paris, France) +33 1 40 33 79 87 http://nuxeo.com mailto:[EMAIL PROTECTED] ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Unicode treatment in 2.6b1
For PageTemplates, the various blocks produced by the template and python are sent to a StringIO-like object, which is responsible for converting them into a coherent thing when its getvalue() method is called. At the moment it doesn't deal very well mixed Unicode and non-Unicode strings so the reported failures don't surprise me. BTW an example of a failing PageTemplate is: html span tal:replace=python:u'hello' / café /html Because, deep inside StringIO, it tries to do something like: ''.join([u'hello', ' café']) -- Florent Guillaume, Nuxeo (Paris, France) +33 1 40 33 79 87 http://nuxeo.com mailto:[EMAIL PROTECTED] ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] [ZOPE 2.6 B1] Unicode/locale problems withOFS/dtml/properties.dtml
Hi I'm Japanese. #Sorry so I don't write english well. While I'm quite sure that this will help Zope in the Asiatic region, it seems quite inconvienent for isolatin1 world :( This will be a win in Europe as well, especially for multilingual sites. IIRC there are 15 variants of ISO-8859-1. I18N is *very* important, and Unicode is an essential ingredient. [1] These 3 filses (total 3 line) change from encode('latin1') to encode('utf-8') $find . -name '*.py' -exec grep -l 'encode.*latin1' {} \; ./lib/python/ZPublisher/Converters.py ./lib/python/ZPublisher/HTTPRequest.py ./lib/python/ZPublisher/HTTPResponse.py [2] This line change from 'iso-8859-1' to 'utf-8' lib/python/App/dtml/manage_page_header.dtml dtml-call REQUEST.set('management_page_charset','iso-8859-1') These changes seems well work for me. But I have not enough test. Are there some reason to treat unicode string not as 'utf-8' but as 'latin1'(iso-8859-1)? Additionaly Japanese languese have some encoding, euc-jp, shift_jis, iso-8859-jp and utf-8 (and another?). I want mechanism to change encoding dinamically. ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )