def cache_rmp(verbose=False): try: os.makedirs("/home/tpetr/cache/schedr/umass/rmp/") except: pass rmp = util.RateMyProfessors(1513, '/home/tpetr/cache/schedr/umass/rmp/') rmp.cache_all()
def import_rmp(): from schedr.northwestern import data def rmp_callback(name, id, rating): if data.INSTRUCTOR_NICKNAMES.has_key(name): name = data.INSTRUCTOR_NICKNAMES[name] try: ins = Instructor.objects.get(name=name) except Instructor.DoesNotExist: return ins.rating_id = id ins.rating = rating ins.save() rmp = util.RateMyProfessors(1513, '/home/tpetr/cache/schedr/northwestern/rmp/') for filename in glob("/home/tpetr/cache/schedr/northwestern/rmp/*.html"): rmp.parse(filename, rmp_callback)