Re: SVN: Zope/trunk/lib/python/AccessControl/ Make python security policy work with a boolean __aatus__
Florent Guillaume wrote:
Log message for revision 68446: Make python security policy work with a boolean __aatus__
Wow, I wasn't aware that only ints were possible. Shouldn't this be backported to Zope 2.9 as well? I consider it a bug when an 1 won't be exchangeable for True in something that's apparently either true of false. By the way, a test for isinstance(__aatus__, int) would also be true for booleans because bool inherits from int. Philipp
On 1 Jun 2006, at 17:53, Philipp von Weitershausen wrote:
Florent Guillaume wrote:
Log message for revision 68446: Make python security policy work with a boolean __aatus__
Wow, I wasn't aware that only ints were possible. Shouldn't this be backported to Zope 2.9 as well? I consider it a bug when an 1 won't be exchangeable for True in something that's apparently either true of false.
Right, I backported it.
By the way, a test for isinstance(__aatus__, int) would also be true for booleans because bool inherits from int.
I didn't want to touch the p.__class__ part because of security proxies came to my mind... In this case it probably doesn't matter but I didn't want to risk it. Florent -- Florent Guillaume, Nuxeo (Paris, France) Director of R&D +33 1 40 33 71 59 http://nuxeo.com fg@nuxeo.com
Florent Guillaume wrote:
On 1 Jun 2006, at 17:53, Philipp von Weitershausen wrote:
Florent Guillaume wrote:
Log message for revision 68446: Make python security policy work with a boolean __aatus__
Wow, I wasn't aware that only ints were possible. Shouldn't this be backported to Zope 2.9 as well? I consider it a bug when an 1 won't be exchangeable for True in something that's apparently either true of false.
Right, I backported it.
Cool, thanks.
By the way, a test for isinstance(__aatus__, int) would also be true for booleans because bool inherits from int.
I didn't want to touch the p.__class__ part because of security proxies came to my mind... In this case it probably doesn't matter but I didn't want to risk it.
So true. Philipp
On 1 Jun 2006, at 18:19, Philipp von Weitershausen wrote:
Florent Guillaume wrote:
On 1 Jun 2006, at 17:53, Philipp von Weitershausen wrote:
By the way, a test for isinstance(__aatus__, int) would also be true for booleans because bool inherits from int.
I didn't want to touch the p.__class__ part because of security proxies came to my mind... In this case it probably doesn't matter but I didn't want to risk it.
So true.
OTOH the C code calls PyInt_Check which does the same as isinstance, so I improved 2.10/trunk. Florent -- Florent Guillaume, Nuxeo (Paris, France) Director of R&D +33 1 40 33 71 59 http://nuxeo.com fg@nuxeo.com
participants (2)
-
Florent Guillaume -
Philipp von Weitershausen