Invalid iCal data breaks ical widget and wreaks havoc ☣ ️
Adding an ical widget and using a URL that does not return valid ical data leads to some… indignancy:
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/django/core/handlers/base.py", line 179, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python3.7/contextlib.py", line 74, in inner
return func(*args, **kwds)
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/rules/contrib/views.py", line 221, in _wrapped_view
return view_func(request, *args, **kwargs)
File "./aleksis/core/views.py", line 95, in index
return render(request, "core/index.html", context)
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/django/shortcuts.py", line 19, in render
content = loader.render_to_string(template_name, context, request, using=using)
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/django/template/loader.py", line 62, in render_to_string
return template.render(context, request)
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/django/template/backends/django.py", line 61, in render
return self.template.render(context)
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/django/template/base.py", line 170, in render
return self._render(context)
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/django/test/utils.py", line 96, in instrumented_test_render
return self.nodelist.render(context)
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/django/template/base.py", line 938, in render
bit = node.render_annotated(context)
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/django/template/base.py", line 905, in render_annotated
return self.render(context)
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/django/template/loader_tags.py", line 150, in render
return compiled_parent._render(context)
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/django/test/utils.py", line 96, in instrumented_test_render
return self.nodelist.render(context)
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/django/template/base.py", line 938, in render
bit = node.render_annotated(context)
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/django/template/base.py", line 905, in render_annotated
return self.render(context)
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/django/template/loader_tags.py", line 62, in render
result = block.nodelist.render(context)
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/django/template/base.py", line 938, in render
bit = node.render_annotated(context)
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/django/template/base.py", line 905, in render_annotated
return self.render(context)
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/django/template/defaulttags.py", line 312, in render
return nodelist.render(context)
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/django/template/base.py", line 938, in render
bit = node.render_annotated(context)
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/django/template/base.py", line 905, in render_annotated
return self.render(context)
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/django/template/defaulttags.py", line 211, in render
nodelist.append(node.render_annotated(context))
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/django/template/base.py", line 905, in render_annotated
return self.render(context)
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/django/template/library.py", line 192, in render
output = self.func(*resolved_args, **resolved_kwargs)
File "./aleksis/core/templatetags/dashboard.py", line 10, in include_widget
context = widget.get_context()
File "/usr/src/AlekSIS-App-DashboardFeeds/aleksis/apps/dashboardfeeds/models.py", line 87, in get_context
"feed_events": get_current_events_with_cal(self.url, self.events_count),
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/cache_memoize/__init__.py", line 120, in inner
result = func(*args, **kwargs)
File "/usr/src/AlekSIS-App-DashboardFeeds/aleksis/apps/dashboardfeeds/util/event_feed.py", line 82, in get_current_events_with_cal
calendar: Calendar = Calendar(content.text)
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/ics/icalendar.py", line 63, in __init__
containers = calendar_string_to_containers(imports)
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/ics/grammar/parse.py", line 199, in calendar_string_to_containers
return string_to_container(string)
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/ics/grammar/parse.py", line 182, in string_to_container
return lines_to_container(txt.splitlines())
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/ics/grammar/parse.py", line 178, in lines_to_container
return parse(tokenize_line(unfold_lines(lines)))
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/ics/grammar/parse.py", line 169, in parse
for line in tokenized_lines:
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/ics/grammar/parse.py", line 164, in tokenize_line
yield ContentLine.parse(line)
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/ics/grammar/parse.py", line 76, in parse
ast = GRAMMAR.parse(line)
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/tatsu/grammars.py", line 1042, in parse
**kwargs
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/tatsu/contexts.py", line 226, in parse
raise self._furthest_exception
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/tatsu/contexts.py", line 694, in _option
yield
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/tatsu/grammars.py", line 445, in parse
ctx.last_node = o.parse(ctx)
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/tatsu/grammars.py", line 733, in parse
return rule()
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/tatsu/grammars.py", line 782, in parse
result = self._parse_rhs(ctx, self.exp)
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/tatsu/grammars.py", line 790, in _parse_rhs
result = ctx._call(ruleinfo)
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/tatsu/contexts.py", line 519, in _call
result = self._recursive_call(ruleinfo)
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/tatsu/contexts.py", line 548, in _recursive_call
return self._invoke_rule(ruleinfo, self.memokey)
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/tatsu/contexts.py", line 595, in _invoke_rule
ruleinfo.impl(self)
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/tatsu/grammars.py", line 733, in parse
return rule()
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/tatsu/grammars.py", line 782, in parse
result = self._parse_rhs(ctx, self.exp)
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/tatsu/grammars.py", line 790, in _parse_rhs
result = ctx._call(ruleinfo)
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/tatsu/contexts.py", line 531, in _call
self._error('Expecting <%s>' % ruleinfo.name)
File "/srv/www/aleksis/venv/lib/python3.7/site-packages/tatsu/contexts.py", line 453, in _error
raise self._make_exception(item, exclass=exclass)
Exception Type: FailedParse at /
This breaks the dashboard and causes Internal Server Errors on all subsequent accesses to the home page, so effectively breaks AlekSIS for all users immediately.
Input vlaidation is a real glory