Re: [Zope-dev] UnicodeDecodeError from PageTemplate rendering after upgrading to Zope 2.12.7
On Tue, Aug 31, 2010 at 11:40 AM, Chris Withers ch...@simplistix.co.ukwrote: Hi All, After a recent upgraded to Zope 2.12, I'm now seeing errors like the following when using IE (version 8) or Safari (version 4.0.3) to view page templates. Chrome and Firefox work fine. Traceback (innermost last): Module ZPublisher.Publish, line 127, in publish Module ZPublisher.mapply, line 77, in mapply Module ZPublisher.Publish, line 47, in call_object snip Module Shared.DC.Scripts.Bindings, line 324, in __call__ Module Shared.DC.Scripts.Bindings, line 361, in _bindAndExec Module Products.PageTemplates.ZopePageTemplate, line 335, in _exec Module Products.PageTemplates.ZopePageTemplate, line 432, in pt_render Module Products.PageTemplates.PageTemplate, line 80, in pt_render Module zope.pagetemplate.pagetemplate, line 115, in pt_render Module zope.tal.talinterpreter, line 271, in __call__ snip Module zope.tal.talinterpreter, line 343, in interpret Module zope.tal.talinterpreter, line 751, in do_insertStructure_tal UnicodeDecodeError: 'ascii' codec can't decode byte 0xa0 in position 366: ordinal not in range(128) Has anyone seen this or anything similar before? Any solutions spring to mind? Hi Chris. No solution, actually, but I would suggest to sniff the traffic between you and the server; I suspect different headers cause problems, here. Regards Marco cheers, Chris -- Simplistix - Content Management, Batch Processing Python Consulting - http://www.simplistix.co.uk ___ 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 ) -- Marco Bizzarri http://code.google.com/p/qt-asterisk/ http://notenotturne.blogspot.com/ http://iliveinpisa.blogspot.com/ ___ 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] SAP SSO feature for Zope/LDAPUserFolder
Dirk Datzert wrote: Hi, we have Zope 2.6.4 and 2.7.6 with LDAPUserFolder and CookieCrumbler in use. One of our next goals is to integrate the Single-Sign-On-Ticket feature of SAP-Portal. SAP sent a cookie called MYSAPSSO2 which contains a certified signature and the Login-Name of a user. Normally the Login-Name will be validated by LDAPUserFolder with password against LDAP-Directory and the roles of the user will be assigned to the user object. We have now an external web-service which can validate the MYSAPSSO2-Ticket and return the Login-Name. I'm looking now for the best way to integrate/rewrite CookieCrumbler/LDAPUserFolder to take the validated Login-Name and read the roles of the user out of the LDAP-directory. Any ideas ? Maybe comments by Jens or Shane ? Regards, Dirk I'm not sure this could work for you... I've tried integrating Zope with an SSO system, which did not provide any authentication other than setting a correct REMOTE_USER in the REQUEST (we did it behind Apache). We succeded by subclassing CookieCrumbler so that it was able to deal with those situations. Also, we were working with Zope in Remote User Mode. I can provide the code, if necessary. Regards Marco ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Access to global methods in product creation forms
Hi all. I would like to use a global method in the add form of a product. I've declared the method in the methods dictionary of the package. However, when I try to add the product, I receive an unauthorized exception. The environment is python2.3.4 and zope 2.7.3, running on Debian GNU/Linux. I've attached a simple test product showing the problem. Thanks you in advance for your support. Regards Marco TestProduct.tgz Description: application/compressed ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Question about _v_ attributes and database connections
On Wed, Mar 10, 2004 at 02:56:33PM +, Chris Withers wrote: Marco Bizzarri wrote: What I would like to do is to have an hook to the removal of a _v_ attribute, so that I can perform some action *BEFORE* losing any reference to the object itself. I look at the setattr code in cPersistence.c and tried also to write my own __setattr__, __setattr__ isn't the hook you're looking for.. Correct, I discovered that after some digging. This is better done in a transcation-hooking type way, a la CTM.py in ZOracleDA... cheers, Chris I'm trying something inspired to that at the moment... I succeeded in installing an hack, very inspired from your code (but at a much simpler level) and some code in the SecurityManager, where I mantain a dictionary of connections, indexed by the result of thread.get_ident(). Once a thread needs a new connection, either it is present in the dictionary or not. If it is present, give it to the thread and assign that to the _v_database_connection attribute. Otherwise, create a new one, put in the dictionary, and go on as before. Of course this is a (horrible) hack, because if you have more than one ZPsycopg objects you will end with mixed connections (argh!) As a proof of concept however it works, and it is resistent to the refreshing of other products (not the ZPsycopg one). Regards Marco -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk -- Marco Bizzarri - Amministratore Delegato - Icube S.r.l. Sede: Via Ridolfi 15 - 56124 Pisa (PI), Italia E-mail: [EMAIL PROTECTED] WWW: www.icube.it Tel:(+39) 050 97 02 07 Fax: (+39) 050 31 36 588 pgp0.pgp Description: PGP signature ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Question about _v_ attributes and database connections
On Mon, Mar 08, 2004 at 09:34:28AM -0500, Jeremy Hylton wrote: On Fri, 2004-03-05 at 16:57, Dieter Maurer wrote: 3) is it possible to disable caching of some object? No, but you can (in most cases) flush it again by calling its _p_deactivate method. You can always do it by assigning None to _p_changed, but this is highly unsafe. You should not do it (unless you really know what you are doing). Another was of saying this is that the cache performs an important role in maintaining object identity. It's not possible to use a persistent object without using a cached version of it. If you think you need to disable caching, you should probably say something more about what you are trying to do. 4) when an _v_ attribute is removed, what code of the object/attribute itself is called? The object's __del__ method (if defined). This means the object that was bound to the _v_ attribute not the object that had the _v_attribute. The setattr hook in cPersistence.c is called when an attribute is removed (del obj.attr). An __del__() method would only be called if the last reference to the object was also deleted. And __del__ is to be avoided whenever possible. What I would like to do is to have an hook to the removal of a _v_ attribute, so that I can perform some action *BEFORE* losing any reference to the object itself. I look at the setattr code in cPersistence.c and tried also to write my own __setattr__, but I do not know what should be called *AFTER* my code. What I would do is: def __setattr__(self, key, value): if key[0:3] == '_v_': doMyStuff() doStandardStuff() but I do not know what doStandardStuff actually is. Regards Marco Jeremy -- Marco Bizzarri - Amministratore Delegato - Icube S.r.l. Sede: Via Ridolfi 15 - 56124 Pisa (PI), Italia E-mail: [EMAIL PROTECTED] WWW: www.icube.it Tel:(+39) 050 97 02 07 Fax: (+39) 050 31 36 588 ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Question about _v_ attributes and database connections
On Fri, Mar 05, 2004 at 11:16:37AM +, Chris Withers wrote: Hi Marco, Hi. Marco Bizzarri wrote: We're trying to tackle a problem in hanging connections in ZPsycopg. Hehe, I fixed this for ZOracleDA a couple of months ago. You may want to look at the thread pool code in there to see how I did it, gimme a nod if you need a URL (it's on a CVS branch in cvs.zope.org) I took a look at that, the connections.CTM, and the other. The simple question is if this is a known problem with *ALL* db adapters, and, in this case, it could be possible to devise a general solution, or if this has something to do with psycopg. I've a scenario where I can produce hanging connections in ZPsycopg: 1) use page with sql methods 2) refresh a product 3) repeat 1) 4) refresh a product if you have 4 threads, you should have now 5 connections. Obviously here there is something wrong with the management of _v_ attributes, in particular the _v_database_connection in the DA.py. The psycopg code is quite similar to the basic DA.py code, so I was looking for other ways of approaching the problem. However, I would like to have some information about the functioning of the _v_ attributes, and the cache management. In particular: 1) where is the code which handles the _v_ attributes (I like to look at the source code, you know ;)) Never bothered finding it, the sematics are pretty well documented. Yes, actually. 2) where is the code which handles the caching of the objects? The ZODB cache. It's big and complicated, trust me, you DON'T need to go there... :( 3) is it possible to disable caching of some object? No. The fact that you want to means you're mis-using _v_ attributes ;-) My feeling was that the hanging connection problem was related to the cache... so the question (I'm not using _v_ attributes in any particular way) 4) when an _v_ attribute is removed, what code of the object/attribute itself is called? None. I believe it gets lost at the object is ghosted. If possible, please answer also directly to me (I'm not on this list). Are you maintaining ZPsychopg? If not, the maintainers might be able to help... No, actually we've a db application which makes a lot of use of zpsycopg for insert/updates, not only for select, and we stumbled on this problem. We're working with Federico Di Gregorio (psycopg mantainer) in order to solve the problem. cheers, Chris - who learnt a whole lot more about ZODB and ZODB caching when solving this kind of problem in ZOracleDA ;-) I suspect I will have to learn something in the hard way too :) -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk Thanks for your help Regards Marco -- Marco Bizzarri - Amministratore Delegato - Icube S.r.l. Sede: Via Ridolfi 15 - 56124 Pisa (PI), Italia E-mail: [EMAIL PROTECTED] WWW: www.icube.it Tel:(+39) 050 97 02 07 Fax: (+39) 050 31 36 588 pgp0.pgp Description: PGP signature ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )