Allow null profiles in prof/import.py
authorW. Trevor King <wking@drexel.edu>
Wed, 30 Jun 2010 15:54:14 +0000 (11:54 -0400)
committerW. Trevor King <wking@drexel.edu>
Wed, 30 Jun 2010 15:54:14 +0000 (11:54 -0400)
sitecore/prof/__init__.py
sitecore/prof/import.py

index 19cb6e280ef96f999665acd23e3bce4d674ce004..a148c3064436804a7ea190718e94620ce5aa8b11 100644 (file)
@@ -175,3 +175,9 @@ class Professor (AttributeHolder):
             return '%s, %s' % (self.contact.lab, self.contact.lab_phone)
         assert self.contact.lab_phone == None, unicode(self.name)
         return None
+
+    def profile(self):
+        if self.bio.profile == None:
+            return None
+        return ''.join(['<p>\n%s\n</p>\n' % p
+                        for p in prof.bio.profile.split('\n')])
index 840a248ffb9b8cd9c3ff929f186c30b65685ba94..2ed57c0d9a0fa8a4e0aeaa66212c6a2ea6dd3e78 100644 (file)
@@ -64,8 +64,7 @@ class ProfessorAdder (object):
             ('Title:', prof.title),
             ('First Name:', prof.name.first_middle),
             ('Last Name:', prof.name.last),
-            ('Bio:', '<p>\n%s\n%</p>'+prof.bio.profile.replace(
-                    '\n', '\n</p>\n<p>\n')),
+            ('Bio:', prof.profile()),
             ('Headshot:', ('/Images/physics/headshots/%s'
                            % name.lower().replace('.','').replace(' ','_'))),
             ('Email:', prof.contact.email),