def migrate_suggestions(source): # read in the content f = open(source) xml = etree.parse(f) f.close() suggestions = xml.getroot() print "migrating", str(len(suggestions)), "suggestion records" for element in suggestions: s = Suggestion() # re-use the journal bibjson crosswalk cb = _to_journal_bibjson(element) s.set_bibjson(cb) # explicitly set the open-access-ness cb.set_open_access(_is_open_access(element)) # suggestion info _to_suggestion(element, s) s.save()