From: W. Trevor King Date: Wed, 30 Jun 2010 15:54:14 +0000 (-0400) Subject: Allow null profiles in prof/import.py X-Git-Url: http://git.tremily.us/?p=sitecorepy.git;a=commitdiff_plain;h=b143d97d0603f1457801bf49a0803c96d5183eae Allow null profiles in prof/import.py --- diff --git a/sitecore/prof/__init__.py b/sitecore/prof/__init__.py index 19cb6e2..a148c30 100644 --- a/sitecore/prof/__init__.py +++ b/sitecore/prof/__init__.py @@ -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(['

\n%s\n

\n' % p + for p in prof.bio.profile.split('\n')]) diff --git a/sitecore/prof/import.py b/sitecore/prof/import.py index 840a248..2ed57c0 100644 --- a/sitecore/prof/import.py +++ b/sitecore/prof/import.py @@ -64,8 +64,7 @@ class ProfessorAdder (object): ('Title:', prof.title), ('First Name:', prof.name.first_middle), ('Last Name:', prof.name.last), - ('Bio:', '

\n%s\n%

'+prof.bio.profile.replace( - '\n', '\n

\n

\n')), + ('Bio:', prof.profile()), ('Headshot:', ('/Images/physics/headshots/%s' % name.lower().replace('.','').replace(' ','_'))), ('Email:', prof.contact.email),