Repository: pimutils/khal

Issue:
Khal crashes on startup due to new priority system code
Up until a few minutes ago I was using khal version `0.9.10`, and then upgraded to `0.10.0` and now it throws an exception on launch due to what appears to be the code added in #812 from the backtrace:

```
Traceback (most recent call last):
  File "/home/linuxbrew/.linuxbrew/bin/ikhal", line 10, in <module>
    sys.exit(main_ikhal())
  File "/home/linuxbrew/.linuxbrew/lib/python3.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/linuxbrew/.linuxbrew/lib/python3.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/linuxbrew/.linuxbrew/lib/python3.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/linuxbrew/.linuxbrew/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/linuxbrew/.linuxbrew/lib/python3.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/linuxbrew/.linuxbrew/lib/python3.7/site-packages/khal/cli.py", line 481, in interactive_cli
    multi_calendar_select(ctx, include_calendar, exclude_calendar)
  File "/home/linuxbrew/.linuxbrew/lib/python3.7/site-packages/khal/cli.py", line 165, in build_collection
    'priority': cal['priority'],
  File "/home/linuxbrew/.linuxbrew/lib/python3.7/site-packages/configobj-5.0.6-py3.7.egg/configobj.py", line 554, in __getitem__
KeyError: 'priority'
```
my khal config has a bunch of calendar entries, none of which contain a `priority` property/key. I did test out adding the key with the default setting to all of my calendars just to see if that fixed it and it continues to get hung-up on this error. My config is back to not including the new `priority` keys and for now gonna just roll back to 0.9.10 via pip as that still seems to work okay. 

Comments:

Patch:
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 45dc5b3..b8b6417 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -7,6 +7,13 @@ Package maintainers and users who have to manually update their installation
 may want to subscribe to `GitHub's tag feed
 <https://github.com/geier/khal/tags.atom>`_.
 
+
+0.10.1
+======
+2019-03-30
+
+* FIX error with the new color priority system and `discover` calendar type
+
 0.10.0
 ======
 2019-03-25
diff --git a/khal/settings/utils.py b/khal/settings/utils.py
index ca03794..ed20432 100644
--- a/khal/settings/utils.py
+++ b/khal/settings/utils.py
@@ -226,7 +226,8 @@ def config_checks(
         calendar = {'path': vdir,
                     'color': _get_color_from_vdir(vdir),
                     'type': _get_vdir_type(vdir),
-                    'readonly': False
+                    'readonly': False,
+                    'priority': 10,
                     }
 
         # get color from config if not defined in vdir


Test patch:
diff --git a/tests/settings_test.py b/tests/settings_test.py
index 037abac..a45fcf0 100644
--- a/tests/settings_test.py
+++ b/tests/settings_test.py
@@ -225,60 +225,70 @@ def test_config_checks(metavdirs):
                 'path': '/cal3/home',
                 'readonly': False,
                 'type': 'calendar',
+                'priority': 10,
             },
             'my calendar': {
                 'color': 'dark blue',
                 'path': '/cal1/public',
                 'readonly': False,
                 'type': 'calendar',
+                'priority': 10,
             },
             'my private calendar': {
                 'color': '#FF00FF',
                 'path': '/cal1/private',
                 'readonly': False,
                 'type': 'calendar',
+                'priority': 10,
             },
             'public': {
                 'color': None,
                 'path': '/cal2/public',
                 'readonly': False,
                 'type': 'calendar',
+                'priority': 10,
             },
             'public1': {
                 'color': None,
                 'path': '/cal3/public',
                 'readonly': False,
                 'type': 'calendar',
+                'priority': 10,
             },
             'work': {
                 'color': None,
                 'path': '/cal3/work',
                 'readonly': False,
                 'type': 'calendar',
+                'priority': 10,
             },
             'cfgcolor': {
                 'color': 'dark blue',
                 'path': '/cal4/cfgcolor',
                 'readonly': False,
                 'type': 'calendar',
+                'priority': 10,
             },
             'dircolor': {
                 'color': 'dark blue',
                 'path': '/cal4/dircolor',
                 'readonly': False,
                 'type': 'calendar',
+                'priority': 10,
             },
             'cfgcolor_again': {
                 'color': 'dark blue',
                 'path': '/cal4/cfgcolor_again',
                 'readonly': False,
                 'type': 'calendar',
+                'priority': 10,
             },
             'cfgcolor_once_more': {
                 'color': 'dark blue',
                 'path': '/cal4/cfgcolor_once_more',
                 'readonly': False,
                 'type': 'calendar',
+                'priority': 10,
             },
 
         },