Skip to content

Commit

Permalink
Handle None protocol in security group rule table
Browse files Browse the repository at this point in the history
Default Quantum security groups come in with a protocol of None via
nova. Horizon chokes when it tries to uppercase what it expects to be
a unicode string.

Replace None with 'Any' when displaying the value.

Fixes bug 1156922.

Change-Id: I94a534e829ecdbe75f785eb8fc750260aacd6dfc
  • Loading branch information
spearki committed Mar 19, 2013
1 parent dc913a4 commit aeab8c7
Showing 1 changed file with 7 additions and 1 deletion.
Expand Up @@ -101,10 +101,16 @@ def get_source(rule):
return None


def filter_protocol(protocol):
if protocol is None:
return _('Any')
return unicode.upper(protocol)


class RulesTable(tables.DataTable):
protocol = tables.Column("ip_protocol",
verbose_name=_("IP Protocol"),
filters=(unicode.upper,))
filters=(filter_protocol,))
from_port = tables.Column("from_port", verbose_name=_("From Port"))
to_port = tables.Column("to_port", verbose_name=_("To Port"))
source = tables.Column(get_source, verbose_name=_("Source"))
Expand Down

0 comments on commit aeab8c7

Please sign in to comment.