コード例 #1
0
	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()
コード例 #2
0
	def testRemovesURLFragments(self):
		"""removes URL fragments"""
		uri = "http://localhost/foo#bar"
		expected = "http://localhost/foo"
		self.assertEqual(expected, utils.trimURI(uri))
コード例 #3
0
	def testConvertsURIToLowercase(self):
		"""converts URI to lowercase"""
		uri = "http://LocalHost/Foo"
		expected = "http://localhost/foo"
		self.assertEqual(expected, utils.trimURI(uri))
コード例 #4
0
	def testRemovesTrailingSlash(self):
		"""removes trailing slash"""
		uri = "http://localhost/"
		expected = "http://localhost"
		self.assertEqual(expected, utils.trimURI(uri))