MCPcopy Index your code
hub / github.com/TKCERT/pfFocus / format_bbcode_cell

Function format_bbcode_cell

pf_focus/bbcode.py:56–80  ·  view source on GitHub ↗
(cell)

Source from the content-addressed store, hash-verified

54 return str(rule_location)
55
56def format_bbcode_cell(cell):
57 if cell is None or (isinstance(cell, PfSenseNode) and cell.data is None):
58 cell = ''
59 elif cell is True or (isinstance(cell, PfSenseNode) and cell.data is True):
60 cell = 'x'
61 elif isinstance(cell, PfSenseRuleAlias):
62 cell = format_rule_alias(cell.data)
63 elif isinstance(cell, PfSenseRuleInterface):
64 cell = format_rule_interface(cell.data)
65 elif isinstance(cell, PfSenseRuleLocation):
66 if hasattr(cell, 'not'):
67 data = '**!** '
68 else:
69 data = ''
70 if hasattr(cell, 'any'):
71 data += 'any'
72 elif hasattr(cell, 'address'):
73 data += format_rule_location(cell.address)
74 elif hasattr(cell, 'network'):
75 data += format_rule_location(cell.network)
76 if hasattr(cell, 'port'):
77 data += ':'
78 data += str(cell.port)
79 cell = data
80 return str(cell).replace('[', '{').replace(']', '}').replace('\n', ' ')
81
82def output_bbcode_table(stream, header, rows):
83 stream.write("[table]\n")

Callers 1

output_bbcodeFunction · 0.85

Calls 3

format_rule_aliasFunction · 0.70
format_rule_interfaceFunction · 0.70
format_rule_locationFunction · 0.70

Tested by

no test coverage detected