python-caldav / caldav

Apache License 2.0
314 stars 94 forks source link

UUID vText #304

Closed gravityfargo closed 1 year ago

gravityfargo commented 1 year ago

Hey hey, I assume this is probably more of a me issue than a bug but I've been working on it for a while and can't figure it out.

When I create a todo, uid= won't accept the uuid data type. When I pull the new task from the server I find that the UUID is something like

"[vText('b'3660b60c-cf24-11ed-a4b6-e0d045c542a2'')\\, vText('b'210b5298-6390-4157-9119-32295c104cb0'')]":

my code looks like this

        serverConnect()
        calendar = serverConnect.my_principal.calendar(cal)
        assert len(taskDict) > 0

        uidNew = str(uuid.uuid4())

        calendar.save_todo(
            summary=taskDict["SUMMARY"],
            due=formattedDate,
            categories=[taskDict["CATEGORIES"]],
            uid=uidNew
        )

I've tried uuid.uuid4() uuid.uuid1() and wrap them in str() and appending .str

in scheduling_examples.py you have

uid = uuid.uuid1()
event = Event()
event.add("dtstamp", datetime.now())
event.add("dtstart", datetime.now() + timedelta(days=4000))
event.add("dtend", datetime.now() + timedelta(days=4000, hours=1))
event.add("uid", uid)
event.add("summary", "Test event with participants but without invites")
caldata2.add_component(event)

So I assumed you could just pass the uuid type, but it throws an error saying it doesn't.

tobixen commented 1 year ago

First of all, please ensure you're either on the v1.2.1-version or on the master branch. At some point I did fix a bug that the uuid field became a list in some circumstances.

gravityfargo commented 1 year ago

We had this conversation already, sorry. Hopefully, this closed issue will help someone else I suppose. I updated my desktop computer and not my laptop, then I forgot!