summaryrefslogtreecommitdiffstats
path: root/ipsilon/info/common.py
diff options
context:
space:
mode:
Diffstat (limited to 'ipsilon/info/common.py')
-rwxr-xr-xipsilon/info/common.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/ipsilon/info/common.py b/ipsilon/info/common.py
index c4be8fe..92a3ba2 100755
--- a/ipsilon/info/common.py
+++ b/ipsilon/info/common.py
@@ -47,6 +47,48 @@ class InfoProviderBase(PluginObject, Log):
self.debug('Info plugin disabled: %s' % self.name)
+class InfoMapping(Log):
+
+ def __init__(self):
+ self.standard_attributes = {
+ 'fullname': 'Full Name',
+ 'nickname': 'Nickname',
+ 'surname': 'Last Name',
+ 'firstname': 'First Name',
+ 'title': 'Title',
+ 'dob': 'Date of Birth',
+ 'email': 'E-mail Address',
+ 'gender': 'Gender',
+ 'postcode': 'Postal Code',
+ 'street': 'Street Address',
+ 'state': 'State or Province',
+ 'country': 'Country',
+ 'phone': 'Telephone Number',
+ 'language': 'Language',
+ 'timezone': 'Time Zone',
+ }
+ self.mapping = dict()
+
+ def set_mapping(self, attrs_map):
+ self.mapping = attrs_map
+
+ def display_name(self, name):
+ if name in self.standard_attributes:
+ return self.standard_attributes[name]
+ return name
+
+ def map_attrs(self, attrs):
+ s = dict()
+ e = dict()
+ for a in attrs:
+ if a in self.mapping:
+ s[self.mapping[a]] = attrs[a]
+ else:
+ e[a] = attrs[a]
+
+ return s, e
+
+
FACILITY = 'info_config'