1 from __pyjamas__ import JS
2
4 dict = {}
5 pairs = urlstring.split("&")
6 for pair in pairs:
7 if len(pair) < 3: continue
8 kv = pair.split("=",1)
9 dict[kv[0]] = kv[1]
10 return dict
11
13 pairs = []
14 for k,v in d.iteritems():
15 pairs.append(k+"="+v)
16 return "&".join(pairs)
17
19 """
20 Retrieve this class by calling Window.getLocation().
21
22 This provides a pyjs wrapper for the current location,
23 with some utility methods for convenience.
24
25 """
29
32
34 if not self.hashDict or self.hashDictHash != self.getHash():
35 self.hashDictHash = self.getHash()
36 self.hashDict = makeUrlDict(self.getHash()[1:])
37 return self.hashDict
38
41
44
47
48 - def getPageHref(self):
49 """
50 Return href with any search or hash stripped
51 """
52 href = self.location.href
53 if href.find("?"): href = href.split("?")[0]
54 if href.find("#"): href = href.split("#")[0]
55 return href
56
59
62
65
68
70 if self.searchDict is None:
71 search = self.getSearch()[1:]
72 self.searchDict = makeUrlDict(search)
73 return self.searchDict
74
77
80
83
86
89
92
95