Browse Source

Fix some exceptions

tags/v0.1^2
Ben Kurtovic 12 years ago
parent
commit
e5371681c0
5 changed files with 11 additions and 6 deletions
  1. +2
    -1
      earwigbot/commands/editcount.py
  2. +2
    -1
      earwigbot/commands/registration.py
  3. +2
    -1
      earwigbot/commands/rights.py
  4. +2
    -1
      earwigbot/tasks/__init__.py
  5. +3
    -2
      earwigbot/tasks/afc_statistics.py

+ 2
- 1
earwigbot/commands/editcount.py View File

@@ -22,6 +22,7 @@


from urllib import quote_plus from urllib import quote_plus


from earwigbot import exceptions
from earwigbot import wiki from earwigbot import wiki
from earwigbot.commands import BaseCommand from earwigbot.commands import BaseCommand


@@ -46,7 +47,7 @@ class Command(BaseCommand):


try: try:
count = user.editcount count = user.editcount
except wiki.UserNotFoundError:
except earwigbot.UserNotFoundError:
msg = "the user \x0302{0}\x0301 does not exist." msg = "the user \x0302{0}\x0301 does not exist."
self.reply(data, msg.format(name)) self.reply(data, msg.format(name))
return return


+ 2
- 1
earwigbot/commands/registration.py View File

@@ -22,6 +22,7 @@


import time import time


from earwigbot import exceptions
from earwigbot import wiki from earwigbot import wiki
from earwigbot.commands import BaseCommand from earwigbot.commands import BaseCommand


@@ -46,7 +47,7 @@ class Command(BaseCommand):


try: try:
reg = user.registration reg = user.registration
except wiki.UserNotFoundError:
except exceptions.UserNotFoundError:
msg = "the user \x0302{0}\x0301 does not exist." msg = "the user \x0302{0}\x0301 does not exist."
self.reply(data, msg.format(name)) self.reply(data, msg.format(name))
return return


+ 2
- 1
earwigbot/commands/rights.py View File

@@ -20,6 +20,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE. # SOFTWARE.


from earwigbot import exceptions
from earwigbot import wiki from earwigbot import wiki
from earwigbot.commands import BaseCommand from earwigbot.commands import BaseCommand


@@ -44,7 +45,7 @@ class Command(BaseCommand):


try: try:
rights = user.groups rights = user.groups
except wiki.UserNotFoundError:
except exceptions.UserNotFoundError:
msg = "the user \x0302{0}\x0301 does not exist." msg = "the user \x0302{0}\x0301 does not exist."
self.reply(data, msg.format(name)) self.reply(data, msg.format(name))
return return


+ 2
- 1
earwigbot/tasks/__init__.py View File

@@ -20,6 +20,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE. # SOFTWARE.


from earwigbot import exceptions
from earwigbot import wiki from earwigbot import wiki


__all__ = ["BaseTask"] __all__ = ["BaseTask"]
@@ -122,7 +123,7 @@ class BaseTask(object):


try: try:
content = page.get() content = page.get()
except wiki.PageNotFoundError:
except exceptions.PageNotFoundError:
return False return False
if content == cfg.get("disabled", "run"): if content == cfg.get("disabled", "run"):
return False return False


+ 3
- 2
earwigbot/tasks/afc_statistics.py View File

@@ -28,6 +28,7 @@ from time import sleep


import oursql import oursql


from earwigbot import exceptions
from earwigbot import wiki from earwigbot import wiki
from earwigbot.tasks import BaseTask from earwigbot.tasks import BaseTask


@@ -470,7 +471,7 @@ class Task(BaseTask):
else: else:
try: try:
ns = self.site.namespace_name_to_id(namespace) ns = self.site.namespace_name_to_id(namespace)
except wiki.NamespaceNotFoundError:
except exceptions.NamespaceNotFoundError:
base = title base = title
ns = wiki.NS_MAIN ns = wiki.NS_MAIN


@@ -720,7 +721,7 @@ class Task(BaseTask):
try: try:
if submitter.blockinfo: if submitter.blockinfo:
notes += "|nb=1" # Submitter is blocked notes += "|nb=1" # Submitter is blocked
except wiki.UserNotFoundError: # Likely an IP
except exceptions.UserNotFoundError: # Likely an IP
pass pass


return notes return notes

Loading…
Cancel
Save