Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed a problem on certain caldav server (LINE Works). #111

Merged
merged 1 commit into from Oct 15, 2020

Conversation

mtorange
Copy link
Contributor

@mtorange mtorange commented Sep 6, 2020

This server returns empty data result (URL only) from date search.
So we have to re-query the data for every event after fetching urls. calendar_multiget() has been added for it.
And the exception on _calendar_comp_class_by_data() on empty data result has been fixed

This server returns empty data result (URL only) from date search.
So we have to re-query the data for every event. calendar_multiget() has been added for it.
And the exception on _calendar_comp_class_by_data() on empty data result has been fixed
Copy link
Member

@tobixen tobixen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to create some test code for this?

@mtorange
Copy link
Contributor Author

Is it possible to create some test code for this?

below is my working code.
but I have no idea how can I create test code (we need specific CalDAV server for testing)

def get_events(url, user, password, calendar_name):
	start_dt = datetime.today() - timedelta(days=7 * 3)
	end_dt = datetime.today() + timedelta(days=7 * 12, hours=23, minutes=59, seconds=59)

	client = DAVClient(url, username=user, password=password)
	principal = client.principal()
	calendars = principal.calendars()

	for c in calendars:
		if calendar_name == c.name:
			events = c.date_search(start_dt, end_dt)
			if len(events) > 0 and events[0].data is None: # <-- server returns events with empty data
				events = c.calendar_multiget([ev.url for ev in events])
			return events
	return None

@tobixen
Copy link
Member

tobixen commented Oct 15, 2020

I'll merge this for now, but raise an issue that ...

  • The multiget method should be exercised in test code, for servers that supports multiget
  • Should add an extra parameter to date_search method to allow it to try to do a multiget if needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants