From b143d97d0603f1457801bf49a0803c96d5183eae Mon Sep 17 00:00:00 2001
From: "W. Trevor King"
Date: Wed, 30 Jun 2010 11:54:14 -0400
Subject: [PATCH] Allow null profiles in prof/import.py
---
sitecore/prof/__init__.py | 6 ++++++
sitecore/prof/import.py | 3 +--
2 files changed, 7 insertions(+), 2 deletions(-)
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),
--
2.26.2