[Twisted-Python] weird problem with subclassing library.door.Door

Chris Armstrong carmstro at dynup.net
Fri Apr 13 20:13:37 EDT 2001

Ok, I made a subclass of Door called SecretDoor. The point of this door is
that it's opened with a remote button and is not visible unless it is open.
I tried implementing this by overriding _close() in my class.

class SecretDoor(door.Door):
    def verb_open(self, sentence):
            sentence.subject.hears("This door is opened elsewhere.")

    def _close(self, actor):

Unfortunately, this did not work.
The _undescribe call was apparently being cancelled out by something that was
resetting the description in the current room. I looked for calls to 
_redescribe(), but couldn't find any that were being called after my 
_undescribe(). Eventually I just decided to hack it out and added:

    def _redescribe(self):
        if not self.isOpen:

This is very bad, but I could not figure out any other way to do it. I still
have it this way, and I just wanted to notify glyph and anyone else who's
interested. Is there a better way to do this? Where is the description being
added back into the room?

Ahh well, thanks a bunch.

Chris Armstrong                        carmstro at twistedmatrix.com
http://twistedmatrix.com/~carmstro     carmstro at dynup.net

More information about the Twisted-Python mailing list