[Zope-Checkins] CVS: Zope3/lib/python/Zope/Server/LineReceiver - LineCommandParser.py:1.1.2.3 LineServerChannel.py:1.1.2.5

Stephan Richter srichter@cbu.edu
Mon, 8 Apr 2002 02:50:59 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/Server/LineReceiver
In directory cvs.zope.org:/tmp/cvs-serv31265/LineReceiver

Modified Files:
      Tag: Zope3-Server-Branch
	LineCommandParser.py LineServerChannel.py 
Log Message:
This is the first working version of the SMTP server. There is still a lot
of work to be done, but it is a start. Now I need to stabalize the code and
write some tests. 

Also, Gerson Kunze (author of Shicks!), whose code I used as a template,
told me that he would be working on implementing ESMTP and a better SPAM 
filter, whcih should make the server even cooler.

I guess we should start discussing how a possible MailService could look
like. 


=== Zope3/lib/python/Zope/Server/LineReceiver/LineCommandParser.py 1.1.2.2 => 1.1.2.3 ===
 
     def parseLine(self, line):
+        print line
         parts = line.split(' ', 1)
         if len(parts) == 2:
             self.cmd, self.args = parts


=== Zope3/lib/python/Zope/Server/LineReceiver/LineServerChannel.py 1.1.2.4 => 1.1.2.5 ===
     unknown_reply = 'CMD_UNKNOWN'
 
+    # Define the error message that occurs, when the reply code was not found.
+    reply_error = '500 Unknown Reply Code: %s.'
+
     # Define the status messages
     status_messages = {
         'CMD_UNKNOWN'      : "500 '%s': command not understood.",
@@ -78,8 +81,11 @@
             return self.task_class(self, command, method)
 
         elif hasattr(self, method):
-            getattr(self, method)(command.args)
-
+            try:
+                getattr(self, method)(command.args)
+            except:
+                import traceback
+                traceback.print_exc()
         else:
             self.reply(self.unknown_reply, cmd.upper())
         return None
@@ -88,9 +94,9 @@
     def reply(self, code, args=(), flush=1):
         """ """
         try:
-            msg = self.status_messages[code] % args
+            msg = self.status_messages[code] %args
         except:
-            msg = '500 Unknown Response: %s.' % repr(code)
+            msg = self.reply_error %code
 
         self.write('%s\r\n' %msg)