Can catch re.error instead of sre_constants.error.

This commit is contained in:
Jeremy Fincher 2003-08-26 17:08:46 +00:00
parent 3dd176ab63
commit 09c77aa234
3 changed files with 5 additions and 6 deletions

View File

@ -35,12 +35,12 @@ Add the module docstring here. This will be used by the setup.py script.
from baseplugin import *
import re
import gzip
import popen2
import random
import os.path
import urllib2
import re, sre_constants
from itertools import imap, ifilter
import conf
@ -103,7 +103,7 @@ class Debian(callbacks.Privmsg, PeriodicFileDownloader):
regexp = '^' + regexp
try:
r = re.compile(regexp, re.I)
except sre_constants.error, e:
except re.error, e:
irc.error(msg, e)
return
if self.usePythonZegrep:

View File

@ -42,7 +42,6 @@ from baseplugin import *
import re
import random
import sre_constants
import debug
import utils
@ -140,7 +139,7 @@ class Topic(callbacks.Privmsg):
replacer = utils.perlReToReplacer(regexp)
except ValueError, e:
irc.error(msg, 'The regexp wasn\'t valid: %s' % e.args[0])
except sre_constants.error, e:
except re.error, e:
irc.error(msg, debug.exnToString(e))
return
topics = irc.state.getTopic(channel).split(self.topicSeparator)

View File

@ -48,7 +48,6 @@ import shlex
import getopt
import inspect
import threading
import sre_constants
from cStringIO import StringIO
import conf
@ -337,6 +336,7 @@ class IrcObjectProxy:
return self.irc.getRealIrc()
def __getattr__(self, attr):
#return getattr(self.getRealIrc(), attr)
return getattr(self.irc, attr)
@ -539,7 +539,7 @@ class PrivmsgRegexp(Privmsg):
try:
r = re.compile(value.__doc__, self.flags)
self.res.append((r, value))
except sre_constants.error, e:
except re.error, e:
s = '%s.%s has an invalid regexp %s: %s' % \
(self.__class__.__name__, name,
value.__doc__, debug.exnToString(e))