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

AttributeError: 'str' object has no attribute 'get_id' when syncing CalDAV #1057

Open
cpitclaudel opened this issue Mar 8, 2024 · 0 comments
Labels
plugins Plugins and extra backends regression Essential features that recently broke

Comments

@cpitclaudel
Copy link

cpitclaudel commented Mar 8, 2024

I'm trying to setup CalDAV sync, and I got the following issue:

2024-03-07 07:55:30,052 - INFO - backend_caldav:_do_periodic_import:137 - Running periodic import
2024-03-07 07:55:30,237 - INFO - backend_caldav:_do_periodic_import:144 - Fetching todos from '<redacted-1>'
2024-03-07 07:55:30,714 - INFO - backend_caldav:_do_periodic_import:144 - Fetching todos from '<redacted-2>'
Exception in thread Thread-3 (_internal_flush_all_tasks):
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.10/threading.py", line 953, in run
2024-03-07 07:55:31,120 - INFO - backend_caldav:_do_periodic_import:137 - Running periodic import
    self._target(*self._args, **self._kwargs)
  File "GTG/core/datastore.py", line 664, in _internal_flush_all_tasks
    backend.queue_set_task(task.id)
  File "GTG/backends/generic_backend.py", line 680, in queue_set_task
    tid = task.get_id()
AttributeError: 'str' object has no attribute 'get_id'

I added a print(task) right before the faulty line, and I got:

33d9760d-2e07-4ae4-9c02-1fcdaeb46325

This is the faulty function:

    def queue_set_task(self, task):
        """ Save the task in the backend. In particular, it just enqueues the
        task in the self.to_set queue. A thread will shortly run to apply the
        requested changes.

        @param task: the task that should be saved
        """
        tid = task.get_id()
        if task not in self.to_set and tid not in self.to_remove:
            self.to_set.appendleft(task)
            self.__try_launch_setting_thread()

Looks like a simple mistake in the caller?

        def _internal_flush_all_tasks():
            backend = self.backends[backend_id]
            for task in self.tasks.data:
                if self.please_quit:
                    break
                backend.queue_set_task(task.id) # ← Should be `task`?

Except that Task objects don't have a get_id, they have .id. After fixing that too I get a bit further in the import before getting to another crash, though in the DAV client this time.

Exception in thread Thread-1 (__backend_startup):
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "GTG/core/datastore.py", line 579, in __backend_startup
    backend.start_get_tasks()
  File "GTG/core/interruptible.py", line 38, in new
    return fn(*args)
  File "GTG/backends/periodic_import_backend.py", line 79, in start_get_tasks
    self._start_get_tasks()
  File "GTG/backends/periodic_import_backend.py", line 98, in _start_get_tasks
    self.do_periodic_import()
  File "GTG/core/interruptible.py", line 38, in new
    return fn(*args)
  File "GTG/backends/backend_caldav.py", line 111, in do_periodic_import
    self._do_periodic_import()
  File "GTG/backends/backend_caldav.py", line 139, in _do_periodic_import
    self._refresh_calendar_list()
  File "GTG/backends/backend_caldav.py", line 217, in _refresh_calendar_list
    principal = self._dav_client.principal()
  File "caldav/davclient.py", line 425, in principal
    self._principal = Principal(client=self, *largs, **kwargs)
  File "caldav/objects.py", line 506, in __init__
    cup = self.get_property(dav.CurrentUserPrincipal())
  File "caldav/objects.py", line 224, in get_property
    foo = self.get_properties([prop], **passthrough)
  File "caldav/objects.py", line 256, in get_properties
    properties = response.expand_simple_props(props)
  File "caldav/davclient.py", line 298, in expand_simple_props
    self.find_objects_and_props()
  File "caldav/davclient.py", line 221, in find_objects_and_props
    responses = self._strip_to_multistatus()
  File "caldav/davclient.py", line 157, in _strip_to_multistatus
    if tree.tag == "xml" and tree[0].tag == dav.MultiStatus.tag:
AttributeError: 'NoneType' object has no attribute 'tag'
@nekohayo nekohayo added plugins Plugins and extra backends regression Essential features that recently broke labels Mar 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugins Plugins and extra backends regression Essential features that recently broke
Projects
None yet
Development

No branches or pull requests

2 participants