Skip to content

Commit

Permalink
Merge pull request #26 from IT-CEREBRUM/fix-ou-info
Browse files Browse the repository at this point in the history
Fix issue with `ou info` (address country)
  • Loading branch information
fredrikhl authored and GitHub Enterprise committed Jan 10, 2023
2 parents f8556be + ab1c041 commit 367c272
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions Cerebrum/modules/bofhd/bofhd_ou_cmds.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
from __future__ import unicode_literals

import logging
import re

import six

Expand Down Expand Up @@ -348,11 +347,19 @@ def ou_info(self, operator, target):
'from_ou': from_ou_str.format(it_contact['from_ou_id'])
})

for a in ou.get_entity_address():
if a['country'] is not None:
a['country'] = ', ' + a['country']
else:
for row in ou.get_entity_address():
a = dict(row)
# TODO: This "breaks" our structured output, should reconsider...
#
# If we are to pre-format fields like this, we should really just
# return an additinal formatted address line for the format
# suggestion, rather than messing with partially formatted fields
# prefixed with ', '
if a['country'] is None:
a['country'] = ''
else:
a['country'] = ', ' + six.text_type(
self.const.Country(a['country']))

if a['p_o_box'] is not None:
a['p_o_box'] = "PO box %s, " % a['p_o_box']
Expand Down

0 comments on commit 367c272

Please sign in to comment.