fields = ['first_middle', 'last']
class Graduation (AttributeHolder):
- fields = ['college', 'title', 'year']
+ fields = ['college', 'field', 'title', 'year']
class Contact (AttributeHolder):
fields = ['office', 'email', 'website', 'phone', 'lab', 'lab_phone']
import getpass
import logging
+import re
import MySQLdb
import yaml
from . import Name, Graduation, Contact, Bio, Professor
+GRADUATION_REGEXP = re.compile('^(\S) +(\S), (.*) *(\d)?$')
+"""Examples:
+
+M.S. Physics, University of Calcutta, Calcutta, India
+Ph.D. Physics, University of Maryland, Maryland, 1967
+"""
+
class SimpleDB (object):
def __init__(self, verbose=0):
self.db = None
p.title += ', %s' % prof['position1']
p.graduations = []
print prof['degrees']
- for degree in prof['degrees']:
- p.greaduations.append(
+ for degree in prof['degrees'].splitlines():
+ m = GRADUATION_REGEXP.match(degree)
+ assert m != None, 'Misformed graduation: %s' % degree
+ title,field,college,year = m.groups()
+ p.graduations.append(
Graduation(
- college=None,
- title=None,
- year=None,
+ college=college,
+ field=field,
+ title=title,
+ year=year,
)
)
p.contact = Contact(