1 from monitor import config
2 import turbogears as tg
6 return "http://" + config.MONITOR_HOSTNAME
7 def plc_mail_uri(ticketid):
8 return config.RT_WEB_SERVER + "/Ticket/Display.html?id=" + str(ticketid)
9 def plc_node_uri(hostname):
10 return "https://" + config.PLC_WWW_HOSTNAME + "/db/nodes/index.php?pattern=" + str(hostname)
11 def plc_node_uri_id(node_id):
12 return "https://" + config.PLC_WWW_HOSTNAME + "/db/nodes/index.php?id=" + str(node_id)
13 def plc_site_uri(loginbase):
14 return "https://" + config.PLC_WWW_HOSTNAME + "/db/sites/index.php?pattern=" + str(loginbase)
15 def plc_site_uri_id(site_id):
16 return "https://" + config.PLC_WWW_HOSTNAME + "/db/sites/index.php?id=" + str(site_id)
17 def plc_pcu_uri_id(pcu_id):
18 return "https://" + config.PLC_WWW_HOSTNAME + "/db/sites/pcu.php?id=" + str(pcu_id)
21 def query_to_path(**kwargs):
26 for key, value in tgparams.iteritems():
29 if isinstance(value, (list, tuple)):
30 pairs = [(key, v) for v in value]
32 pairs = [(key, value)]
36 if isinstance(v, unicode):
38 args.append((k, str(v)))
40 query_string = urllib.urlencode(args, True)
42 tgpath += '&' + query_string
44 tgpath += '?' + query_string
47 def link(base, **kwargs):
49 str = "?query=" + base + query_to_path(**kwargs)
51 str = tg.url(base, **kwargs)
52 #print "CREATED %s" % str