Skip to content

Commit 9fb2ec2

Browse files
committed
Added handling for an exception which could occur for charter documents which does not have a matching chartered group.
- Legacy-Id: 11886
1 parent ca692d9 commit 9fb2ec2

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

ietf/doc/models.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from ietf.person.models import Email, Person
1919
from ietf.utils.admin import admin_link
2020

21+
2122
class StateType(models.Model):
2223
slug = models.CharField(primary_key=True, max_length=30) # draft, draft-iesg, charter, ...
2324
label = models.CharField(max_length=255, help_text="Label that should be used (e.g. in admin) for state drop-down for this type of state") # State, IESG state, WG state, ...
@@ -411,14 +412,17 @@ def latest_event(self, *args, **filter_args):
411412
return e[0] if e else None
412413

413414
def canonical_name(self):
415+
from ietf.doc.utils_charter import charter_name_for_group # Imported locally to avoid circular imports
414416
name = self.name
415417
if self.type_id == "draft" and self.get_state_slug() == "rfc":
416418
a = self.docalias_set.filter(name__startswith="rfc")
417419
if a:
418420
name = a[0].name
419421
elif self.type_id == "charter":
420-
from ietf.doc.utils_charter import charter_name_for_group
421-
return charter_name_for_group(self.chartered_group)
422+
try:
423+
name = charter_name_for_group(self.chartered_group)
424+
except Group.DoesNotExist:
425+
pass
422426
return name
423427

424428
def canonical_docalias(self):

0 commit comments

Comments
 (0)