mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-23 18:44:04 +01:00
Nicer getattr.
This commit is contained in:
parent
bf0037d291
commit
6243fe6baf
@ -36,10 +36,8 @@ import os.path
|
|||||||
|
|
||||||
installDir = os.path.dirname(sys.modules[__name__].__file__)
|
installDir = os.path.dirname(sys.modules[__name__].__file__)
|
||||||
|
|
||||||
srcDir = os.path.join(installDir, 'src')
|
|
||||||
othersDir = os.path.join(installDir, 'others')
|
othersDir = os.path.join(installDir, 'others')
|
||||||
|
|
||||||
sys.path.insert(0, srcDir)
|
|
||||||
sys.path.insert(0, othersDir)
|
sys.path.insert(0, othersDir)
|
||||||
|
|
||||||
class Author(object):
|
class Author(object):
|
||||||
@ -60,9 +58,13 @@ class authors(object): # This is basically a bag.
|
|||||||
skorobeus = Author('Kevin Murphy', 'Skorobeus', 'skoro@skoroworld.com')
|
skorobeus = Author('Kevin Murphy', 'Skorobeus', 'skoro@skoroworld.com')
|
||||||
inkedmn = Author('Brett Kelly', 'inkedmn', 'inkedmn@users.sf.net')
|
inkedmn = Author('Brett Kelly', 'inkedmn', 'inkedmn@users.sf.net')
|
||||||
bwp = Author('Brett Phipps', 'bwp', 'phippsb@gmail.com')
|
bwp = Author('Brett Phipps', 'bwp', 'phippsb@gmail.com')
|
||||||
|
unknown = Author('Unknown author', 'unknown', 'unknown@supybot.org')
|
||||||
|
|
||||||
# Let's be somewhat safe about this.
|
# Let's be somewhat safe about this.
|
||||||
def __getattr__(self, attr):
|
def __getattr__(self, attr):
|
||||||
return Author('Unknown author', 'unknown', 'unknown@supybot.org')
|
try:
|
||||||
|
return getattr(super(authors, self), attr.lower())
|
||||||
|
except AttributeError:
|
||||||
|
return self.unknown
|
||||||
|
|
||||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||||
|
Loading…
Reference in New Issue
Block a user