Import of Contact Relationships fails with DuplicateRelationship error

Bug #882482 reported by Gediminas Paulauskas
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SchoolTool
Fix Released
Critical
Alan Elkner

Bug Description

I exported to xls, modified something, and tried to import. First, it failed on timetables (Bug #878209), I deleted that sheet and tried again. Now I got exception in Contact Relationships:

Traceback:
File "/home/menesis/.buildout/eggs/zope.publisher-3.12.6-py2.7.egg/zope/publisher/publish.py", line 132, in publish
  result = publication.callObject(request, obj)
File "/home/menesis/.buildout/eggs/zope.app.publication-3.13.2-py2.7.egg/zope/app/publication/zopepublication.py", line 207, in callObject
  return mapply(ob, request.getPositionalArguments(), request)
File "/home/menesis/.buildout/eggs/zope.publisher-3.12.6-py2.7.egg/zope/publisher/publish.py", line 107, in mapply
  return debug_call(obj, args)
Extra information: <schooltool.skin.flourish.zcml_content.FlourishMegaImporter_import.html object at 0xf4835cc>
File "/home/menesis/.buildout/eggs/zope.publisher-3.12.6-py2.7.egg/zope/publisher/publish.py", line 113, in debug_call
  return obj(*args)
File "/home/menesis/src/schooltool/flourish/src/schooltool/src/schooltool/skin/flourish/page.py", line 68, in __call__
  self.update()
File "/home/menesis/src/schooltool/flourish/src/schooltool/src/schooltool/export/importer.py", line 1286, in update
  imp.import_data(wb)
File "/home/menesis/src/schooltool/flourish/src/schooltool/src/schooltool/export/importer.py", line 262, in import_data
  return self.process()
File "/home/menesis/src/schooltool/flourish/src/schooltool/src/schooltool/export/importer.py", line 915, in process
  IContactable(person).contacts.add(contact, info)
File "/home/menesis/src/schooltool/flourish/src/schooltool/src/schooltool/relationship/relationship.py", line 376, in add
  (other, self.other_role), extra_info)
File "/home/menesis/src/schooltool/flourish/src/schooltool/src/schooltool/relationship/relationship.py", line 54, in relate
  raise DuplicateRelationship
DuplicateRelationship:

This exception itself is not very informative, because it doesn't print person, contact, and relationship.

Maybe a row was in fact duplicated, then a human readable error should be displayed.

But what happens in this case is that without checking that such a relationship already exists, a new contact is being added.

So this not a user error, but a bug in the new contact import code (Bug #608873).

description: updated
Alan Elkner (aelkner)
Changed in schooltool:
status: New → Fix Committed
Revision history for this message
Gediminas Paulauskas (menesis) wrote :

Thank you very much!

Changed in schooltool:
milestone: none → 1.9.3
Changed in schooltool:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.