Mercurial > hg > urlmatch
diff 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 |
line wrap: on
line diff
--- a/urlmatch.py Fri Jun 17 10:52:29 2011 -0700 +++ b/urlmatch.py Mon Jun 27 07:16:46 2011 -0700 @@ -52,7 +52,18 @@ url2 = self.decompose(url) # TODO: finish - raise NotImplementedError + for i in self.order: + if i in url1 and i in url2: + if url1[i] == url2[i]: + continue + if isinstance(url1[i], basestring): + raise NotImplementedError + else: + retval = url1.get(i, url2[i]) + if isinstance(retval, basestring): + return {i: retval} + return {i: retval[0]} + def match(self, url): if '://' not in url: