comparison urlmatch.py @ 7:ef0553c4bbcd

more stubbing
author Jeff Hammel <jhammel@mozilla.com>
date Mon, 27 Jun 2011 11:07:38 -0700
parents 0cd69fa6751c
children b02420253bfd
comparison
equal deleted inserted replaced
6:0cd69fa6751c 7:ef0553c4bbcd
56 if i in url1 and i in url2: 56 if i in url1 and i in url2:
57 if url1[i] == url2[i]: 57 if url1[i] == url2[i]:
58 continue 58 continue
59 if isinstance(url1[i], basestring): 59 if isinstance(url1[i], basestring):
60 raise NotImplementedError 60 raise NotImplementedError
61 else:
62 raise NotImplementedError
63 elif i not in url1 and i not in url2:
64 continue
61 else: 65 else:
62 retval = url1.get(i, url2[i]) 66 retval1 = url1.get(i)
63 if isinstance(retval, basestring): 67 retval2 = url2.get(i)
64 return {i: retval} 68 if isinstance(retval1, basestring) or isinstance(retval2, basestring):
65 return {i: retval[0]} 69 return {i: (retval1, retval2)}
66 70 if retval1 is not None:
71 retval1 = retval1[0]
72 if retval2 is not None:
73 retval2 = retval2[0]
74 return {i: [(retval1, retval2)]}
75
67 76
68 def match(self, url): 77 def match(self, url):
69 if '://' not in url: 78 if '://' not in url:
70 # give a bogus scheme for urlparse. boo! 79 # give a bogus scheme for urlparse. boo!
71 urldict = self.decompose('bogus://' + url) 80 urldict = self.decompose('bogus://' + url)