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

how to delete calendar #7

Closed
maxandersen opened this issue Feb 21, 2017 · 6 comments
Closed

how to delete calendar #7

maxandersen opened this issue Feb 21, 2017 · 6 comments
Labels
need-feedback Nothing will be done without more info/feedback from someone that can reproduce the issue

Comments

@maxandersen
Copy link

I can successfully create a calendar via make_calendar but I have not found a way to delete a calendar.

calling cal.delete() result in an error.

I do this:

client = caldav.DAVClient(url)
principal = client.principal()
calendars = principal.calendars()

for c in calendars:
    if c.name == 'orgtodo':
        c.delete()

which gives me:

Login to https://xhz:secret@p01-caldav.icloud.com:443/
Traceback (most recent call last):
  File "test.py", line 38, in <module>
    c.delete()
  File "/usr/local/lib/python2.7/site-packages/caldav/objects.py", line 238, in delete
    raise error.DeleteError(errmsg(r))
caldav.lib.error.DeleteError: 400 Bad Request

<html><head><title>Bad Request</title></head><body><h1>Bad Request</h1><p>Client sent illegal depth header value for DELETE: 1</p></body></html>

Is this icloud specific or is delete broken or not the right way to do it ?

@tobixen
Copy link
Member

tobixen commented Mar 12, 2017

Sorry the slow response, seems like I've forgotten to set up email notifications on new issues here.

This is probably related to #3

@kyloe
Copy link
Contributor

kyloe commented Aug 13, 2017

Have investigated here for iCloud (I guess this will be representative)

Looks like caldav 0.5 sends a 'Depth' header on DELETE requests, which iCloud objects to.

instead of

    calendar.delete()

try this code fragment as a work around

    del calendar.client.headers['Depth']
    calendar.client.request(calendar.url,'DELETE')

Works for iCloud - will make a pull request with some other stuff also in the near future

You may need to re-instate 'depth' for other calls - not sure yet.

@tobixen
Copy link
Member

tobixen commented Mar 9, 2019

I'm looking into this now. The dirty-naïve solution, just add that "del client.headers['Depth']" in the request caused test failures, besides it feels completely wrong.

Looking a bit into the code, I can't understand how 'Depth' got into the client headers at all. It does not belong there. Hm.

@tobixen
Copy link
Member

tobixen commented Mar 9, 2019

I threw in a temporary assert that there should be no Depth in client.headers, and the test code passes. No depth header should be passed in the delete request. I don't understand this.

@tobixen tobixen added the need-feedback Nothing will be done without more info/feedback from someone that can reproduce the issue label Mar 9, 2019
@tobixen
Copy link
Member

tobixen commented Mar 9, 2019

Seems related to #3

@tobixen
Copy link
Member

tobixen commented Mar 10, 2019

I assume this bug was fixed with 72a089c. Closing.

@tobixen tobixen closed this as completed Mar 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need-feedback Nothing will be done without more info/feedback from someone that can reproduce the issue
Projects
None yet
Development

No branches or pull requests

3 participants