def removeDuplicates(self, repo): # XXX: rename!? """ remove plugins whose origin is not the repository specified @param repo (str): repository URL @return: None """ repo = trimURI(repo) for plugin in self.store.findChildren("div", title = True): slices = getSlices(plugin.pre.renderContents()) if "Source" in slices: # N.B.: plugin accepted if Source slice not present -- XXX: harmful? (e.g. includes simple config tweaks) try: source = decodePrettyLink(slices["Source"])["uri"] except ValueError: source = slices["Source"] source = trimURI(source) if source != repo: plugin.extract()
def testReturnsLabelAndURI(self): """returns dictionary with label and URI""" str = "[[foo|bar]]" expected = { "label": "foo", "uri": "bar" } self.assertEqual(expected, utils.decodePrettyLink(str))