~sampointon/mudpyl/trunk

« back to all changes in this revision

Viewing changes to mudpyl/matchers.py

  • Committer: Sam Pointon
  • Date: 2008-08-08 15:10:34 UTC
  • Revision ID: sampointon@gmail.com-20080808151034-9v4n9sjvaw4jkp48
make trace respect tracing when it's called

Show diffs side-by-side

added added

removed removed

Lines of Context:
129
129
 
130
130
    def _write_after(self):
131
131
        """Write everything we've been waiting to."""
132
 
        for noteline, sls, message_type in self._writing_after:
133
 
            if message_type == 'write':
134
 
                self.parent.write(noteline, sls)
135
 
            elif message_type == 'trace':
136
 
                self.parent.trace(noteline)
137
 
            else:
138
 
                raise RuntimeError("dunno what %s is" % message_type)
 
132
        for noteline, sls in self._writing_after:
 
133
            self.parent.write(noteline, sls)
139
134
 
140
135
    def write(self, line, soft_line_start = False):
141
136
        """Write a line to the screen.
142
137
 
143
138
        This buffers until the original line has been displayed or echoed.
144
139
        """
145
 
        self._writing_after.append((line, soft_line_start, 'write'))
 
140
        self._writing_after.append((line, soft_line_start))
146
141
 
147
142
    def send(self, line, echo = False):
148
143
        """Send a line to the MUD immediately."""
162
157
 
163
158
    def trace(self, line):
164
159
        """Forward the debugging decision to our parent."""
165
 
        self._writing_after.append((line, False, 'trace'))
 
160
        self.parent._trace_with(line, self)
 
161
 
 
162
    def _trace_with(self, line, realm):
 
163
        """Forward a trace request up the stack of realms."""
 
164
        self.parent._trace_with(line, realm)