Skip to content
Snippets Groups Projects
Commit 70ba3d3b authored by magicfelix's avatar magicfelix
Browse files

Reformat

parent b5985b99
No related branches found
No related tags found
1 merge request!1147Implement read-only CalDAV and CardDAV
Pipeline #195917 failed
......@@ -815,7 +815,7 @@ class CalendarEventMixin(DAVResource, RegistryObject, is_registry=True):
prefetch_related: Sequence | None = None,
expand_start: Optional[datetime] = None,
expand_end: Optional[datetime] = None,
expand: bool = False
expand: bool = False,
) -> QuerySet:
"""Return all objects that should be included in the calendar."""
qs = cls.objects if start_qs is None else start_qs
......@@ -838,7 +838,7 @@ class CalendarEventMixin(DAVResource, RegistryObject, is_registry=True):
prefetch_related=prefetch_related,
expand_start=expand_start,
expand_end=expand_end,
expand=expand
expand=expand,
)
return qs
......
from datetime import datetime, timezone
from zoneinfo import ZoneInfo
import pytest
from recurrence import WEEKLY, Recurrence, Rule
from zoneinfo import ZoneInfo
from aleksis.core.models import CalendarEvent
......
......@@ -617,7 +617,6 @@ class ExtendedICal20Feed(feedgenerator.ICal20Feed):
event.pop(prop)
calendar.add_component(event)
def get_single_events(self, start=None, end=None, with_reference_object: bool = False):
"""Get single event objects for this feed."""
events = recurring_ical_events.of(
......
......@@ -127,19 +127,18 @@ class DAVRequest(ElementHandler, ContentHandler):
if obj is None:
self.resources.append(self.resource)
if self.depth != 0:
if _is_registry:
resources = []
if self.resource == DAVResource:
resources += self.resource.get_sub_registries().values()
if self.resource != DAVResource or self.depth is None:
if hasattr(self.resource, "valid_feeds"):
resources += self.resource.valid_feeds
else:
resources += self.resource.get_registry_objects().values()
for rcls in resources:
self.resources.append(rcls)
if self.depth != 0 and _is_registry:
resources = []
if self.resource == DAVResource:
resources += self.resource.get_sub_registries().values()
if self.resource != DAVResource or self.depth is None:
if hasattr(self.resource, "valid_feeds"):
resources += self.resource.valid_feeds
else:
resources += self.resource.get_registry_objects().values()
for rcls in resources:
self.resources.append(rcls)
else:
self.objects.append(obj)
......@@ -339,4 +338,6 @@ class QueryBase:
def post_handle(self):
if self.request.objects is None:
self.request.objects = self.request.resource.get_objects(request=self.request._request, start_qs=self.request.objects)
self.request.objects = self.request.resource.get_objects(
request=self.request._request, start_qs=self.request.objects
)
......@@ -15,7 +15,6 @@ class TimeRangeFilter(ElementHandler):
invisible = True
def post_handle(self):
filters = {}
report_base = next(iter(self.request.children))
for k, v in self.attrs.items():
......@@ -118,9 +117,6 @@ class Expand(ElementHandler):
name = "{urn:ietf:params:xml:ns:caldav}expand"
def post_handle(self):
filters = {}
report_base = next(iter(self.request.children))
for k, v in self.attrs.items():
if k in [(None, "start"), (None, "end")]:
d = datetime.fromisoformat(v)
......@@ -149,8 +145,6 @@ class CalendarData(ElementHandler):
def process_xml(self, base, response):
super().process_xml(base, response)
if not self.invisible:
report_base = next(iter(base.request.children))
if response.obj is not None:
objects = response.resource.objects.filter(pk=response.obj.pk)
else:
......@@ -233,7 +227,6 @@ class ReportBase(QueryBase):
"request": self.request._request,
}
def post_handle(self):
super().post_handle()
......@@ -246,7 +239,9 @@ class ReportBase(QueryBase):
if timezone is not None:
prop = next(filter(lambda child: isinstance(child, DAVProp), self.children))
calendar_data = next(filter(lambda child: isinstance(child, CalendarData), prop.children))
calendar_data = next(
filter(lambda child: isinstance(child, CalendarData), prop.children)
)
calendar_data.params["timezone"] = timezone.content
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment