From 98a4d6f3867778640746f19dc1cebb15c895200a Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sat, 26 Jun 2010 18:10:16 -0400 Subject: [PATCH] More fixups to Graduation parsing --- sitecore/prof/export_mysql.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sitecore/prof/export_mysql.py b/sitecore/prof/export_mysql.py index 3fa9e6f..59ee6a4 100644 --- a/sitecore/prof/export_mysql.py +++ b/sitecore/prof/export_mysql.py @@ -33,7 +33,7 @@ from .. import get_logger from . import Name, Graduation, Contact, Bio, Professor -GRADUATION_REGEXP = re.compile('^(\S*) +(\S*), (\D*) *(\d*)$') +GRADUATION_REGEXP = re.compile('^(\S*) +(\S*), (\D*)(, *(\d*))?$') """Examples: M.S. Physics, University of Calcutta, Calcutta, India @@ -173,11 +173,10 @@ Where the relevant categories are if prof['position1'] != None: p.title += ', %s' % prof['position1'] p.graduations = [] - print prof['degrees'] for degree in prof['degrees'].splitlines(): - m = GRADUATION_REGEXP.match(degree) + m = GRADUATION_REGEXP.match(degree.strip()) assert m != None, 'Misformed graduation: %s' % degree - title,field,college,year = m.groups() + title,field,college,comma_year,year = m.groups() if year == '': year = None p.graduations.append( @@ -202,7 +201,7 @@ Where the relevant categories are profile=prof['profile'], cv=None, ) - self.logger.debug(unicode(p)) + db.logger.debug(unicode(p)) yield p -- 2.26.2