Re: [Zope3-dev] Security Proxy/isinstance
Andres Freund wrote: Hi, Dominik Huber wrote: You can use zapi.isinstance (zope.security.proxy orig. place). This function is useful because it works even if the instance is security proxied. I know that from irc but there are two issues: -Fixing that in foreign code is dirty and error prone. In my own code i wouldn't have a problem with it. -Why not fix it in the proxies if the problem can be solved? Thats the way much more clean way i think. You don't want to learn new ways, if the old ones can be made compatible. For now i fixed that through monkey patching, but i don't like that. This can't be fixed by changing the proxy behavior. Security proxies expose a valid __class__ attribute except that it is security proxied. It isn't valid to change this. Unfortunately, the standard Python isinstance requires that the value if the __class__ attribute is a known class type. It does this because it uses internal C data structures of types which it can't get to through a proxy. Jim -- Jim Fulton mailto:[EMAIL PROTECTED] Python Powered! CTO (540) 361-1714http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org ___ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com
Re: [Zope3-dev] Security Proxy/isinstance
Hi, Dominik Huber wrote: You can use zapi.isinstance (zope.security.proxy orig. place). This function is useful because it works even if the instance is security proxied. I know that from irc but there are two issues: -Fixing that in foreign code is dirty and error prone. In my own code i wouldn't have a problem with it. -Why not fix it in the proxies if the problem can be solved? Thats the way much more clean way i think. You don't want to learn new ways, if the old ones can be made compatible. For now i fixed that through monkey patching, but i don't like that. Andres Freund ___ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com
Re: [Zope3-dev] Security Proxy/isinstance
Andres Freund wrote: Hi, I'm working with the combination of Zope3 and sqlobjet over sqlos and discovered a problem (about SecurityProxy as i already asked about in #zope3-dev). Some code in sqlobject is using isinstance() to decide what to do. The problem is, that sometimes sqlobject gets securityProxied objects from Zope, which theoretically is no problem. But in praxis it uses isinstance and the SecurityProxy doesn't cooperate with that. Now i searched a bit in the web and discovered, that according to this: http://mail.python.org/pipermail/python-bugs-list/2003-February/016098.html it should be possible to make the Proxies a bit more transparent. Did i understand that correctly? I dont understand to much about python and especially about zope, but i think, that should be the way to go, or am i mistaken? After a short look at _zope_proxy_proxy.c i think that this shouldn't be too hard to implement (although i never touched the python c bindings before, so it not unlikely that I'm mistaken). You can use zapi.isinstance (zope.security.proxy orig. place). This function is useful because it works even if the instance is security proxied. Regards, Dominik begin:vcard fn:Dominik Huber n:Huber;Dominik email;internet:[EMAIL PROTECTED] tel;work:++41 56 534 77 30 x-mozilla-html:FALSE version:2.1 end:vcard ___ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com
[Zope3-dev] Security Proxy/isinstance
Hi, I'm working with the combination of Zope3 and sqlobjet over sqlos and discovered a problem (about SecurityProxy as i already asked about in #zope3-dev). Some code in sqlobject is using isinstance() to decide what to do. The problem is, that sometimes sqlobject gets securityProxied objects from Zope, which theoretically is no problem. But in praxis it uses isinstance and the SecurityProxy doesn't cooperate with that. Now i searched a bit in the web and discovered, that according to this: http://mail.python.org/pipermail/python-bugs-list/2003-February/016098.html it should be possible to make the Proxies a bit more transparent. Did i understand that correctly? I dont understand to much about python and especially about zope, but i think, that should be the way to go, or am i mistaken? After a short look at _zope_proxy_proxy.c i think that this shouldn't be too hard to implement (although i never touched the python c bindings before, so it not unlikely that I'm mistaken). Andres Freund ___ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com