Cleanup warnings: unused imports, etc

This commit is contained in:
Michael Spang 2007-12-13 23:06:55 -05:00
parent 217c9806f1
commit 9110a41969
9 changed files with 7 additions and 11 deletions

View File

@ -7,6 +7,7 @@ This module provides some simple but generally useful exception classes.
class InvalidArgument(Exception):
"""Exception class for bad argument values."""
def __init__(self, argname, argval, explanation):
Exception.__init__(self)
self.argname, self.argval, self.explanation = argname, argval, explanation
def __str__(self):
return 'Bad argument value "%s" for %s: %s' % (self.argval, self.argname, self.explanation)

View File

@ -52,6 +52,7 @@ class MemberException(Exception):
class InvalidTerm(MemberException):
"""Exception class for malformed terms."""
def __init__(self, term):
MemberException.__init__(self)
self.term = term
def __str__(self):
return "Term is invalid: %s" % self.term
@ -59,12 +60,14 @@ class InvalidTerm(MemberException):
class NoSuchMember(MemberException):
"""Exception class for nonexistent members."""
def __init__(self, memberid):
MemberException.__init__(self)
self.memberid = memberid
def __str__(self):
return "Member not found: %d" % self.memberid
class ChildFailed(MemberException):
def __init__(self, program, status, output):
MemberException.__init__(self)
self.program, self.status, self.output = program, status, output
def __str__(self):
msg = '%s failed with status %d' % (self.program, self.status)

View File

@ -1,6 +1,5 @@
import urwid
from ceo import members
from ceo.excep import InvalidArgument
from ceo.urwid import search
from ceo.urwid.widgets import *
from ceo.urwid.window import *

View File

@ -1,6 +1,4 @@
import urwid
from ceo import members
from ceo.excep import InvalidArgument
from ceo.urwid.widgets import *
from ceo.urwid.window import *

View File

@ -19,10 +19,10 @@ class LdapFilter:
if key == 'enter' or key == 'down' or key == 'up':
attr = self.escape(self.attr)
search = self.escape(self.widget.get_edit_text(self))
filter = '(%s=%s)' % (attr, search)
ldfilter = '(%s=%s)' % (attr, search)
try:
matches = self.ldap.search_s(self.base,
ldap.SCOPE_SUBTREE, filter)
ldap.SCOPE_SUBTREE, ldfilter)
if len(matches) > 0:
(_, attrs) = matches[0]
for (k, v) in self.map.items():

View File

@ -1,6 +1,5 @@
import random, ldap, urwid.curses_display
from ceo import members, terms
from ceo.excep import InvalidArgument
from ceo import members
from ceo.urwid.widgets import *
from ceo.urwid.window import *
from ceo.urwid import newmember, renew, info, search, positions, groups
@ -151,5 +150,4 @@ def start():
print "Hint: You may need to run 'kinit'"
if __name__ == '__main__':
import os
start()

View File

@ -1,6 +1,5 @@
import urwid
from ceo import members, terms
from ceo.excep import InvalidArgument
from ceo.urwid.widgets import *
from ceo.urwid.window import *

View File

@ -1,6 +1,5 @@
import urwid
from ceo import members
from ceo.excep import InvalidArgument
from ceo.urwid.widgets import *
from ceo.urwid.window import *

View File

@ -1,6 +1,5 @@
import urwid
from ceo import members, terms
from ceo.excep import InvalidArgument
from ceo.urwid.widgets import *
from ceo.urwid.window import *