1 from monitor import config
2 import turbogears as tg
5 def plc_node_uri(hostname):
6 return "https://" + config.PLC_WWW_HOSTNAME + "/db/nodes/index.php?nodepattern=" + str(hostname)
7 def plc_site_uri(loginbase):
8 return "https://" + config.PLC_WWW_HOSTNAME + "/db/sites/index.php?site_pattern=" + str(loginbase)
9 def plc_site_uri_id(site_id):
10 return "https://" + config.PLC_WWW_HOSTNAME + "/db/sites/index.php?id=" + str(site_id)
11 def plc_pcu_uri_id(pcu_id):
12 return "https://" + config.PLC_WWW_HOSTNAME + "/db/sites/pcu.php?id=" + str(pcu_id)
15 def query_to_path(**kwargs):
20 for key, value in tgparams.iteritems():
23 if isinstance(value, (list, tuple)):
24 pairs = [(key, v) for v in value]
26 pairs = [(key, value)]
30 if isinstance(v, unicode):
32 args.append((k, str(v)))
34 query_string = urllib.urlencode(args, True)
36 tgpath += '&' + query_string
38 tgpath += '?' + query_string
41 def link(base, **kwargs):
43 str = "?query=" + base + query_to_path(**kwargs)
45 str = tg.url(base, **kwargs)
46 #print "CREATED %s" % str