Revision: 8777 Author: valhallasw Date: 2010-12-13 23:07:45 +0000 (Mon, 13 Dec 2010) Log Message: ----------- Workaround for pydot 1.0.3 API change
In pydot >= 1.0.3, get_edge always returns a list, while in <= 1.0.2, it returned the edge it if only one edge was listed.
Modified Paths: -------------- trunk/pywikipedia/interwiki_graph.py
Modified: trunk/pywikipedia/interwiki_graph.py =================================================================== --- trunk/pywikipedia/interwiki_graph.py 2010-12-13 23:06:39 UTC (rev 8776) +++ trunk/pywikipedia/interwiki_graph.py 2010-12-13 23:07:45 UTC (rev 8777) @@ -83,8 +83,12 @@ sourceLabel = self.getLabel(refPage) targetLabel = self.getLabel(page) edge = pydot.Edge(sourceLabel, targetLabel) + oppositeEdge = self.graph.get_edge(targetLabel, sourceLabel) if oppositeEdge: + if isinstance(oppositeEdge, list): + # bugfix for pydot >= 1.0.3 + oppositeEdge = oppositeEdge[0] #oppositeEdge.set_arrowtail('normal') oppositeEdge.set_dir('both') # workaround for bug [ 1722739 ]: prevent duplicate edges