do not fail creating subjects list on bad data
This commit is contained in:
parent
f375f4c6d6
commit
30cb1879c4
|
@ -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):
|
||||
|
|
Reference in New Issue