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 * from baseplugin import *
import re
import gzip import gzip
import popen2 import popen2
import random import random
import os.path import os.path
import urllib2 import urllib2
import re, sre_constants
from itertools import imap, ifilter from itertools import imap, ifilter
import conf import conf
@ -103,7 +103,7 @@ class Debian(callbacks.Privmsg, PeriodicFileDownloader):
regexp = '^' + regexp regexp = '^' + regexp
try: try:
r = re.compile(regexp, re.I) r = re.compile(regexp, re.I)
except sre_constants.error, e: except re.error, e:
irc.error(msg, e) irc.error(msg, e)
return return
if self.usePythonZegrep: if self.usePythonZegrep:

View File

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

View File

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