diff --git a/tabellio/contact/form.py b/tabellio/contact/form.py index 2c656ad..635a9af 100644 --- a/tabellio/contact/form.py +++ b/tabellio/contact/form.py @@ -47,8 +47,13 @@ class View(grok.View): def get_possible_subjects(context): terms = [] for line in context.context.subjects.splitlines(): - topic, email = line.strip().split('|') + try: + topic, email = line.strip().split('|') + except ValueError: + continue terms.append(SimpleVocabulary.createTerm(topic, topic.encode('ascii', 'replace'), topic)) + if len(terms) == 0: + terms.append(SimpleVocabulary.createTerm('-', '-', '-')) return SimpleVocabulary(terms) class IEffectiveContact(interface.Interface):