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