Mercurial > hg > urlmatch
comparison urlmatch.py @ 6:0cd69fa6751c
add test for decomposition; stub diff, will have to move to 2-tuples to do this properly
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Mon, 27 Jun 2011 07:16:46 -0700 |
parents | 23be092e6099 |
children | ef0553c4bbcd |
comparison
equal
deleted
inserted
replaced
5:6b99523536ee | 6:0cd69fa6751c |
---|---|
50 url1 = self.decompose(url) | 50 url1 = self.decompose(url) |
51 if isinstance(url2, basestring): | 51 if isinstance(url2, basestring): |
52 url2 = self.decompose(url) | 52 url2 = self.decompose(url) |
53 | 53 |
54 # TODO: finish | 54 # TODO: finish |
55 raise NotImplementedError | 55 for i in self.order: |
56 if i in url1 and i in url2: | |
57 if url1[i] == url2[i]: | |
58 continue | |
59 if isinstance(url1[i], basestring): | |
60 raise NotImplementedError | |
61 else: | |
62 retval = url1.get(i, url2[i]) | |
63 if isinstance(retval, basestring): | |
64 return {i: retval} | |
65 return {i: retval[0]} | |
66 | |
56 | 67 |
57 def match(self, url): | 68 def match(self, url): |
58 if '://' not in url: | 69 if '://' not in url: |
59 # give a bogus scheme for urlparse. boo! | 70 # give a bogus scheme for urlparse. boo! |
60 urldict = self.decompose('bogus://' + url) | 71 urldict = self.decompose('bogus://' + url) |