The function `check_field_names` has an `else` without a matching `if`, at
least considering the indentation level of the code above the `if`.
It is not clear to me what is going on in this code, and I just stumbled on
it while working a different issue. Olemis, would you kindly take a look?:
>From bloodhound_dashboard/bhdashboard/widgets/ticket.py:
def check_field_name():
if fieldnm is None:
raise InvalidWidgetArgument('field', 'Missing ticket field')
tsys = self.env[TicketSystem]
if tsys is None:
raise TracError(_('Error loading ticket system
(disabled?)'))
for field in tsys.get_ticket_fields():
if field['name'] == fieldnm:
_field.append(field)
break
else:
if fieldnm in field_maps:
admin_suffix = field_maps.get(fieldnm)['admin_url']
if 'TICKET_ADMIN' in req.perm and admin_suffix is not
None:
hint = _('You can add one or more '
'<a href="%(url)s">here</a>.',
url=req.href.admin('ticket', admin_suffix))
else:
hint = _('Contact your administrator for further
details')
return 'widget_alert.html', \
{
'title' :
Markup(field_maps[fieldnm]['title']),
'data' : dict(msgtype='info',
msglabel="Note",
msgbody=Markup(_('''No values are
defined for ticket field
<em>%(field)s</em>. %(hint)s''',
field=fieldnm, hint=hint))
)
}, context
else:
raise InvalidWidgetArgument('field',
'Unknown ticket field %s' % (fieldnm,))
return None