forked from public/pyceo
Cleanup warnings: unused imports, etc
This commit is contained in:
parent
217c9806f1
commit
9110a41969
|
@ -7,6 +7,7 @@ This module provides some simple but generally useful exception classes.
|
||||||
class InvalidArgument(Exception):
|
class InvalidArgument(Exception):
|
||||||
"""Exception class for bad argument values."""
|
"""Exception class for bad argument values."""
|
||||||
def __init__(self, argname, argval, explanation):
|
def __init__(self, argname, argval, explanation):
|
||||||
|
Exception.__init__(self)
|
||||||
self.argname, self.argval, self.explanation = argname, argval, explanation
|
self.argname, self.argval, self.explanation = argname, argval, explanation
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return 'Bad argument value "%s" for %s: %s' % (self.argval, self.argname, self.explanation)
|
return 'Bad argument value "%s" for %s: %s' % (self.argval, self.argname, self.explanation)
|
||||||
|
|
|
@ -52,6 +52,7 @@ class MemberException(Exception):
|
||||||
class InvalidTerm(MemberException):
|
class InvalidTerm(MemberException):
|
||||||
"""Exception class for malformed terms."""
|
"""Exception class for malformed terms."""
|
||||||
def __init__(self, term):
|
def __init__(self, term):
|
||||||
|
MemberException.__init__(self)
|
||||||
self.term = term
|
self.term = term
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "Term is invalid: %s" % self.term
|
return "Term is invalid: %s" % self.term
|
||||||
|
@ -59,12 +60,14 @@ class InvalidTerm(MemberException):
|
||||||
class NoSuchMember(MemberException):
|
class NoSuchMember(MemberException):
|
||||||
"""Exception class for nonexistent members."""
|
"""Exception class for nonexistent members."""
|
||||||
def __init__(self, memberid):
|
def __init__(self, memberid):
|
||||||
|
MemberException.__init__(self)
|
||||||
self.memberid = memberid
|
self.memberid = memberid
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "Member not found: %d" % self.memberid
|
return "Member not found: %d" % self.memberid
|
||||||
|
|
||||||
class ChildFailed(MemberException):
|
class ChildFailed(MemberException):
|
||||||
def __init__(self, program, status, output):
|
def __init__(self, program, status, output):
|
||||||
|
MemberException.__init__(self)
|
||||||
self.program, self.status, self.output = program, status, output
|
self.program, self.status, self.output = program, status, output
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
msg = '%s failed with status %d' % (self.program, self.status)
|
msg = '%s failed with status %d' % (self.program, self.status)
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import urwid
|
import urwid
|
||||||
from ceo import members
|
from ceo import members
|
||||||
from ceo.excep import InvalidArgument
|
|
||||||
from ceo.urwid import search
|
from ceo.urwid import search
|
||||||
from ceo.urwid.widgets import *
|
from ceo.urwid.widgets import *
|
||||||
from ceo.urwid.window import *
|
from ceo.urwid.window import *
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
import urwid
|
import urwid
|
||||||
from ceo import members
|
|
||||||
from ceo.excep import InvalidArgument
|
|
||||||
from ceo.urwid.widgets import *
|
from ceo.urwid.widgets import *
|
||||||
from ceo.urwid.window import *
|
from ceo.urwid.window import *
|
||||||
|
|
||||||
|
|
|
@ -19,10 +19,10 @@ class LdapFilter:
|
||||||
if key == 'enter' or key == 'down' or key == 'up':
|
if key == 'enter' or key == 'down' or key == 'up':
|
||||||
attr = self.escape(self.attr)
|
attr = self.escape(self.attr)
|
||||||
search = self.escape(self.widget.get_edit_text(self))
|
search = self.escape(self.widget.get_edit_text(self))
|
||||||
filter = '(%s=%s)' % (attr, search)
|
ldfilter = '(%s=%s)' % (attr, search)
|
||||||
try:
|
try:
|
||||||
matches = self.ldap.search_s(self.base,
|
matches = self.ldap.search_s(self.base,
|
||||||
ldap.SCOPE_SUBTREE, filter)
|
ldap.SCOPE_SUBTREE, ldfilter)
|
||||||
if len(matches) > 0:
|
if len(matches) > 0:
|
||||||
(_, attrs) = matches[0]
|
(_, attrs) = matches[0]
|
||||||
for (k, v) in self.map.items():
|
for (k, v) in self.map.items():
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import random, ldap, urwid.curses_display
|
import random, ldap, urwid.curses_display
|
||||||
from ceo import members, terms
|
from ceo import members
|
||||||
from ceo.excep import InvalidArgument
|
|
||||||
from ceo.urwid.widgets import *
|
from ceo.urwid.widgets import *
|
||||||
from ceo.urwid.window import *
|
from ceo.urwid.window import *
|
||||||
from ceo.urwid import newmember, renew, info, search, positions, groups
|
from ceo.urwid import newmember, renew, info, search, positions, groups
|
||||||
|
@ -151,5 +150,4 @@ def start():
|
||||||
print "Hint: You may need to run 'kinit'"
|
print "Hint: You may need to run 'kinit'"
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
import os
|
|
||||||
start()
|
start()
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import urwid
|
import urwid
|
||||||
from ceo import members, terms
|
from ceo import members, terms
|
||||||
from ceo.excep import InvalidArgument
|
|
||||||
from ceo.urwid.widgets import *
|
from ceo.urwid.widgets import *
|
||||||
from ceo.urwid.window import *
|
from ceo.urwid.window import *
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import urwid
|
import urwid
|
||||||
from ceo import members
|
from ceo import members
|
||||||
from ceo.excep import InvalidArgument
|
|
||||||
from ceo.urwid.widgets import *
|
from ceo.urwid.widgets import *
|
||||||
from ceo.urwid.window import *
|
from ceo.urwid.window import *
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import urwid
|
import urwid
|
||||||
from ceo import members, terms
|
from ceo import members, terms
|
||||||
from ceo.excep import InvalidArgument
|
|
||||||
from ceo.urwid.widgets import *
|
from ceo.urwid.widgets import *
|
||||||
from ceo.urwid.window import *
|
from ceo.urwid.window import *
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue