diff --git a/themis/libellioimport/migration.py b/themis/libellioimport/migration.py index d72f7b7..31e028b 100644 --- a/themis/libellioimport/migration.py +++ b/themis/libellioimport/migration.py @@ -21,7 +21,10 @@ class Migrate(BrowserView): return 'Missing filename\n' fd = file(os.path.join('/tmp/', filename)) else: - fd = cStringIO.StringIO(self.request.form['data']) + try: + fd = cStringIO.StringIO(self.request.form['data']) + except KeyError: + return 'Missing data\n' doc = cPickle.load(fd) portal = getToolByName(self.context, 'portal_url').getPortalObject() @@ -198,6 +201,10 @@ class Migrate(BrowserView): plone_tool = getToolByName(self.context, 'plone_utils') portal = getToolByName(self.context, 'portal_url').getPortalObject() author = unicode(author, 'utf-8') + author = { + u'de Donn\xe9a Fran\xe7ois-Xavier': u'de Donn\xe9a, Fran\xe7ois-Xavier', + u'Doulkeridis Christos': u'Doulkeridis, Christos', + }.get(author, author) author_id = plone_tool.normalizeString(author) if author_id == 'college': return 'ministry:college' @@ -223,10 +230,31 @@ class Migrate(BrowserView): plone_tool = getToolByName(self.context, 'plone_utils') portal = getToolByName(self.context, 'portal_url').getPortalObject() author = unicode(author, 'utf-8') - if len(author.split()) > 3: - if not 'Warnaffe' in author and \ - not 'Jonghe' in author: - print >> self.logfile, 'W: author with (too?) many parts: %r' % author + author = { + u'Brotchi Jacques': u'Brothi, Jacques', + u'De Bock Emmanuel': u'De Bock, Emmanuel', + u'Defoss\xe9 Jean-Claude': u'Defoss\xe9, Jean-Claude', + u"d'Ursel Anne Charlotte": u"d'Ursel, Anne Charlotte", + u'El Khannouss Ahmed': u'El Khannouss, Ahmed', + u'Ikazban Jamal': u'Ikazban, Jamal', + u'Lurquin Vincent': u'Lurquin, Vincent', + u'Mandaila Gis\xe8le': u'Mandaila, Gis\xe8le', + u'Maron Alain': u'Maron, Alain', + u'Migisha Pierre': u'Migisha, Pierre', + u'Morel Jacques': u'Morel, Jacques', + u'Mouhssin Ahmed': u'Mouhssin, Ahmed', + u'Moureaux Catherine': u'Moureaux, Catherine', + u'Ouriaghli Mohamed': u'Ouriaghli, Mohamed', + u'Ozdemir Mahinur': u'Ozdemir, Mahinur', + u'Pinxteren Arnaud': u'Pinxteren, Arnaud', + u'Sessler Patrick': u'Sessler, Patrick', + u'Sidibe Fatoumata': u'Sidibe, Fatoumata', + u'Trachte Barbara': u'Trachte, Barbara', + u'Van Goidsenhoven Ga\xebtan': u'Van Goidsenhoven, Ga\xebtan', + u'Vanhalewyn Vincent': u'Vanhalewyn, Vincent', + u'Willame Boonen Magdeleine': u'Willame Boonen, Magdeleine', + u'Govers, Pascale, ': u'Govers, Pascale', + }.get(author, author) author_id = plone_tool.normalizeString(author) if not portal.deputes.has_key(author_id): workflow_tool = getToolByName(self.context, 'portal_workflow')