19 Oct
2002
19 Oct
'02
11:39 a.m.
Brian Quinlan
That is definitely one possible way to do it. However, I am wrapping a complete DOM, with dozens of objects containing, collectively, hundreds of methods.
Adding an explicit check to each method seemed like a lot more pain than using proxies.
You don't have to add it to every method. You can perform the check in tp_getattro before performing the method lookup. Alternatively, you can change the ob_type of the object to simply drop the methods that are not available anymore. Regards, Martin