Fix error on publish if no non-root superuser/staff accounts exist

We need to set a default for this variable or you get an
UnboundLocalError if no non-root superuser/staff accounts are set up in
the database.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
Paul Eggleton 2017-12-22 13:10:25 +13:00
parent bc26b95d0b
commit d728f56311

View File

@ -270,6 +270,7 @@ def publish(request, name):
bodytext = get_template('layerindex/publishemail.txt')
maintainer_names = [m.name for m in maintainers]
# find appropriate help contact
help_contact = None
for user in User.objects.all():
if user.username != 'root' and (user.is_staff or user.is_superuser) and user.is_active:
help_contact = user