Re: PyDS 0.7.2 upgrade problems
Matsui Tetsushi <[email protected]> Mon, 17 May 2004 12:20:01 +0900
| Newsgroups | gmane.comp.pythin.pyds.devel |
|---|---|
| Message-ID | <sa6wu3brb8e.wl%[email protected]> |
Hello, At Sun, 16 May 2004 23:02:37 +0200, Georg Bauer wrote: > > > Tool.py 912 process_request s = tool.index_html(req) > > MeshTool.py 855 index_html toolHasSig[tool] = False > > NuggetsTool.py 263 __getattr__ else: raise KeyError(name) > > Ah, that's an known thingy. I thought I had stomped them, but there > seem to be other places where this specific proble pops up. The reason > is a somehow changed behaviour in __getattr__ stuff. With 2.2 you can > use an object that has __getattr__ defined in most ways exactly as if > it hadn't __getattr__ defined. In 2.3 there seem to be much more > situations where some magic method should be called and that breaks, > because StandardTool doesn't define that one. Some places where I first > found them was with code like > > if tool: > # do something > > This didn't work with NuggetsTool and MacrosTool because they didn't > have __nonzero__ defined - neither directly nor by means of > StandardTool. With 2.2 they had some kind of default behaviour: every > instance was nonzero. To fix this for 2.3, I defined __nonzero__ for > tools that define __getattr__. So if you give me the detail for the > KeyError, I might just plug in the missing method and it should work > again. The key is __hash__ and plugging in def __hash__(self): return id(self) them works fine with Python 2.3. -- MATSUI Fe2+ Tetsushi http://homepage3.nifty.com/text/ (http://lowlife.jp/mft/ for blog)