summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2016-01-24 04:22:39 +0100
committerAlexander Sulfrian <alexander@sulfrian.net>2016-01-25 01:56:14 +0100
commit64ab1d6c61905df0c1c81ca8b7fb2135bb5692ee (patch)
tree131fbc0b00b12bd15efce3a02ca9c45eaefbf4f8
parent78fa5a8435b150859e7fe106a7068e76575212f6 (diff)
downloadweb-64ab1d6c61905df0c1c81ca8b7fb2135bb5692ee.tar.gz
web-64ab1d6c61905df0c1c81ca8b7fb2135bb5692ee.tar.bz2
web-64ab1d6c61905df0c1c81ca8b7fb2135bb5692ee.zip
Account: Allow direct access to attribues
-rw-r--r--accounts/account.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/accounts/account.py b/accounts/account.py
index a0d1f27..4c522a0 100644
--- a/accounts/account.py
+++ b/accounts/account.py
@@ -368,6 +368,13 @@ class Account:
"""
self._set_attribute('mail', new_mail)
+ def __getattr__(self, name):
+ if name in self.attributes:
+ return self.attributes[name]
+
+ raise AttributeError("'%s' object has no attribute '%s'" %
+ (self.__class__.__name__, name))
+
class NoSuchUserError(ValueError):
pass