populate wikihomepage in dddatabuilder.py
authorJan Dittberner <jan@dittberner.info>
Fri, 11 Jun 2010 22:13:04 +0000 (00:13 +0200)
committerJan Dittberner <jan@dittberner.info>
Fri, 11 Jun 2010 22:13:04 +0000 (00:13 +0200)
ddportfolioservice/model/dddatabuilder.py

index 4128a5f..8d26d5a 100644 (file)
 #
 """This file contains code to build a representation of a person based
 on keyring data associated to a given email address."""
+import logging
 from ddportfolioservice.model import keyfinder
 
 TYPE_NO = 0
 TYPE_DM = 1
 TYPE_DD = 2
 
+log = logging.getLogger(__name__)
+
 
 def build_data(email_address):
     """Build a DD data structure from a given email address."""
@@ -43,4 +46,9 @@ def build_data(email_address):
         fields['type'] = TYPE_DM
     else:
         fields['type'] = TYPE_NO
+    if fields['name']:
+        log.debug('generate wikihomepage from name')
+        fields['wikihomepage'] = "".join(
+            [part.capitalize() for part in fields['name'].split()])
+
     return fields