1 from monitor import config
4 def plc_node_uri(hostname):
5 return "https://" + config.PLC_WWW_HOSTNAME + "/db/nodes/index.php?nodepattern=" + str(hostname)
6 def plc_site_uri(loginbase):
7 return "https://" + config.PLC_WWW_HOSTNAME + "/db/sites/index.php?site_pattern=" + str(loginbase)
8 def plc_site_uri_id(site_id):
9 return "https://" + config.PLC_WWW_HOSTNAME + "/db/sites/index.php?id=" + str(site_id)
10 def plc_pcu_uri_id(pcu_id):
11 return "https://" + config.PLC_WWW_HOSTNAME + "/db/sites/pcu.php?id=" + str(pcu_id)
14 def query_to_path(**kwargs):
19 for key, value in tgparams.iteritems():
22 if isinstance(value, (list, tuple)):
23 pairs = [(key, v) for v in value]
25 pairs = [(key, value)]
29 if isinstance(v, unicode):
31 args.append((k, str(v)))
33 query_string = urllib.urlencode(args, True)
35 tgpath += '&' + query_string
37 tgpath += '?' + query_string
40 def link(base, ext=True, **kwargs):
42 str = "?query=" + base + query_to_path(**kwargs)
44 str = tg.url(base, **kwargs)
45 #print "CREATED %s" % str