]> granicus.if.org Git - python/commitdiff
OK, checking in patch 103329.
authorMoshe Zadka <moshez@math.huji.ac.il>
Fri, 19 Jan 2001 19:56:27 +0000 (19:56 +0000)
committerMoshe Zadka <moshez@math.huji.ac.il>
Fri, 19 Jan 2001 19:56:27 +0000 (19:56 +0000)
Please check it against your nearest pop server --
mine doesn't support APOP (I checked I'm getting the same error
message, though)

Lib/poplib.py

index 2f55f7421518daf4714038eefe284a0d29b00df5..4e23ff96aa3f7281a28fd038e6a767d90c60d1f7 100644 (file)
@@ -15,7 +15,7 @@ TESTPASSWORD = "_passwd_"
 
 # Imports
 
-import regex, socket, string
+import re, socket, string
 
 # Exception raised when an error or invalid response is received:
 
@@ -263,7 +263,7 @@ class POP3:
         return self._shortcmd('RPOP %s' % user)
 
 
-    timestamp = regex.compile('\+OK.*\(<[^>]+>\)')
+    timestamp = re.compile(r'\+OK.*(<[^>]+>)')
 
     def apop(self, user, secret):
         """Authorisation
@@ -276,10 +276,11 @@ class POP3:
 
         NB: mailbox is locked by server from here to 'quit()'
         """
-        if self.timestamp.match(self.welcome) <= 0:
+        m = self.timestamp.match(self.welcome)
+        if not m:
             raise error_proto('-ERR APOP not supported by server')
         import md5
-        digest = md5.new(self.timestamp.group(1)+secret).digest()
+        digest = md5.new(m.group(1)+secret).digest()
         digest = string.join(map(lambda x:'%02x'%ord(x), digest), '')
         return self._shortcmd('APOP %s %s' % (user, digest))