From: W. Trevor King Date: Sat, 26 Jun 2010 22:10:16 +0000 (-0400) Subject: More fixups to Graduation parsing X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=98a4d6f3867778640746f19dc1cebb15c895200a;p=sitecorepy.git More fixups to Graduation parsing --- 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