Feature Http Forwards Link
Closes #166 (closed)
{{ resolvedDiscussionCount }}/{{ discussionCount }} {{ resolvedCountText }} resolved
-
Owner
+1
-
2 3 register = template.Library() 4 5 6 LINKABLE_PORTS = {80: "http", 8080: "http", 443: "https", 21: "ftp"} 7 8 9 @register.simple_tag(name="display_portforward") 10 def display_pf(ports): 11 is_ipv6 = "ipv6" in ports 12 data = ports["ipv6" if is_ipv6 else "ipv4"] 13 14 if ports['private'] in LINKABLE_PORTS.keys(): 15 href = "%s:%d" % (data['host'], data['port']) 16 return '<a href="%s://%s">%s</a>' % ( 17 LINKABLE_PORTS.get(ports['private']), href, href) -
Owner
LINKABLE_PORTS[ports['private']]
?
-
-
1 from django import template 2 3 register = template.Library() 4 5 6 LINKABLE_PORTS = {80: "http", 8080: "http", 443: "https", 21: "ftp"} 7 8 9 @register.simple_tag(name="display_portforward") 10 def display_pf(ports): 11 is_ipv6 = "ipv6" in ports 12 data = ports["ipv6" if is_ipv6 else "ipv4"] 13 14 if ports['private'] in LINKABLE_PORTS.keys(): -
Owner
if ports['private'] in LINKABLE_PORTS:
?
-