khal: ikhal: Deleting instances of recurring revent yileds AssertionError

I’m running fc5c2bf and just tried to use ikhal to delete one instance of a recurring event. Upon quitting ikhal, I get an assertion error:

Traceback (most recent call last):
  File "/home/madduck/code/pimutils/.ve/lib/python3.5/site-packages/khal-0.9.7.dev102+gfc5c2bf-py3.5.egg/khal/ui/__init__.py", line 1346, in start_pane
    loop.run()
  File "/home/madduck/code/pimutils/.ve/lib/python3.5/site-packages/urwid-1.3.1-py3.5-linux-x86_64.egg/urwid/main_loop.py", line 278, in run
    self._run()
  File "/home/madduck/code/pimutils/.ve/lib/python3.5/site-packages/urwid-1.3.1-py3.5-linux-x86_64.egg/urwid/main_loop.py", line 376, in _run
    self.event_loop.run()
  File "/home/madduck/code/pimutils/.ve/lib/python3.5/site-packages/urwid-1.3.1-py3.5-linux-x86_64.egg/urwid/main_loop.py", line 682, in run
    self._loop()
  File "/home/madduck/code/pimutils/.ve/lib/python3.5/site-packages/urwid-1.3.1-py3.5-linux-x86_64.egg/urwid/main_loop.py", line 719, in _loop
    self._watch_files[fd]()
  File "/home/madduck/code/pimutils/.ve/lib/python3.5/site-packages/urwid-1.3.1-py3.5-linux-x86_64.egg/urwid/raw_display.py", line 393, in <lambda>
    event_loop, callback, self.get_available_raw_input())
  File "/home/madduck/code/pimutils/.ve/lib/python3.5/site-packages/urwid-1.3.1-py3.5-linux-x86_64.egg/urwid/raw_display.py", line 493, in parse_input
    callback(processed, processed_codes)
  File "/home/madduck/code/pimutils/.ve/lib/python3.5/site-packages/urwid-1.3.1-py3.5-linux-x86_64.egg/urwid/main_loop.py", line 403, in _update
    self.process_input(keys)
  File "/home/madduck/code/pimutils/.ve/lib/python3.5/site-packages/urwid-1.3.1-py3.5-linux-x86_64.egg/urwid/main_loop.py", line 509, in process_input
    something_handled |= bool(self.unhandled_input(k))
  File "/home/madduck/code/pimutils/.ve/lib/python3.5/site-packages/urwid-1.3.1-py3.5-linux-x86_64.egg/urwid/main_loop.py", line 555, in unhandled_input
    return self._unhandled_input(input)
  File "/home/madduck/code/pimutils/.ve/lib/python3.5/site-packages/khal-0.9.7.dev102+gfc5c2bf-py3.5.egg/khal/ui/base.py", line 204, in on_key_press
    self.backtrack()
  File "/home/madduck/code/pimutils/.ve/lib/python3.5/site-packages/khal-0.9.7.dev102+gfc5c2bf-py3.5.egg/khal/ui/base.py", line 189, in backtrack
    cb(data)
  File "/home/madduck/code/pimutils/.ve/lib/python3.5/site-packages/khal-0.9.7.dev102+gfc5c2bf-py3.5.egg/khal/ui/__init__.py", line 1102, in cleanup
    self.collection.update(event)
  File "/home/madduck/code/pimutils/.ve/lib/python3.5/site-packages/khal-0.9.7.dev102+gfc5c2bf-py3.5.egg/khal/khalendar/khalendar.py", line 165, in update
    assert event.etag
AssertionError

The change is not saved, i.e. the event is not updated on disk.

Looking at the code, while running, event is a khal.khalendar.event.LocalizedEvent, but event.etag is None.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 6
  • Comments: 19 (6 by maintainers)

Commits related to this issue

Most upvoted comments

Any update on this bug?

After some investigations, I found that event object returned byself.collection.get_event() in cleanup() doesn’t contain the etag, I need to test a bit more and investigate.

For now, i found a little workaround by modifing cleanup() like this:

    def cleanup(self, data):
        """delete all events marked for deletion"""
        for part in self._deleted[ALL]:
            account, href, etag = part.split('\n', 2)
            self.collection.delete(href, etag, account)
        for part, rec_id in self._deleted[INSTANCES]:
            account, href, etag = part.split('\n', 2)
            event = self.collection.get_event(href, account)
            event.delete_instance(rec_id)
            event.etag = etag
            self.collection.update(event)

I’m running the newest version, Version: 0.10.4-2 on Arch Linux, and it is not fixed.

I’m pretty sure this has been fixed. Update to a modern/current version.

Thanks for sharing me this particular case because I didn’t test it with my (ugly) workaround.

That’s I said previously, this issue need more investigation, I’m on it

Thanks all for testing 😀`:

diff --git a/ui/__init__.py b/ui/__init__.py
index d0efa68..395c450 100644
--- a/ui/__init__.py
+++ b/ui/__init__.py
@@ -1101,6 +1101,7 @@ class ClassicView(Pane):
             account, href, etag = part.split('\n', 2)
             event = self.collection.get_event(href, account)
             event.delete_instance(rec_id)
+            event.etag = etag
             self.collection.update(event)
 
     def keypress(self, size, key):

Is working for me too, thanks 😃

@evan-goode thanks for testing it, now I try to investigate deeply in the code.