Hi, On Sat, Apr 08, 2017 at 09:15:53PM +0200, Guido Günther wrote: > so decode properly from utf-8. > > This unbreaks calypso with newer python-vobject: > > https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=841247 > --- > I've moved the code into methods so we could check what vobject > does and adjust but requiring python-vobject 0.9 is o.k. IMHO. > > If this makes sense I could fix this up for Stretch. > > calypso/webdav.py | 23 ++++++++++++----------- > requirements.txt | 2 +- > tests/test_collection.py | 2 +- > 3 files changed, 14 insertions(+), 13 deletions(-) > > diff --git a/calypso/webdav.py b/calypso/webdav.py > index 4fc128c..0bbf5cf 100644 > --- a/calypso/webdav.py > +++ b/calypso/webdav.py > @@ -433,9 +433,15 @@ class Collection(object): > self.log.debug('Wrote %s to %s', file, path) > return path > > + def _action_msg(self, action, item): > + return u'%s %s' % (action, str(item).decode('utf-8')) > + > + def _log_action(self, action, item): > + self.log.debug("%s %s", action, item.name.decode('utf-8')) > + > def create_file(self, item, context): > # Create directory if necessary > - self.log.debug("Add %s", item.name) > + self._log_action("Add", item) > if not os.path.exists(os.path.dirname(self.path)): > try: > os.makedirs(os.path.dirname(self.path)) > @@ -443,8 +449,7 @@ class Collection(object): > self.log.exception("Failed to make collection directory %s: > %s", self.path, ose) > raise > > - context['action'] = u'Add %s'%item > - > + context['action'] = self._action_msg("Add", item) > try: > path = self.write_file(item) > self.git_add(path, context=context) > @@ -458,10 +463,8 @@ class Collection(object): > raise > > def destroy_file(self, item, context): > - self.log.debug("Remove %s", item.name) > - > - context['action'] = u'Remove %s'%item > - > + self._log_action("Remove", item) > + context['action'] = self._action_msg("Remove", item) > try: > os.unlink(item.path) > self.git_rm(item.path, context=context) > @@ -471,10 +474,8 @@ class Collection(object): > raise > > def rewrite_file(self, item, context): > - self.log.debug("Change %s", item.name) > - > - context['action'] = u'Modify %s'%item > - > + self._log_action("Change", item) > + context['action'] = self._action_msg("Modify", item) > try: > new_path = self.write_file(item) > os.rename(new_path, item.path) > diff --git a/requirements.txt b/requirements.txt > index 7512adf..613c087 100644 > --- a/requirements.txt > +++ b/requirements.txt > @@ -1,2 +1,2 @@ > python-daemon==2.1.1 > -git+https://github.com/eventable/[email protected]#egg=vobject > +vobject==0.9.4.1 > diff --git a/tests/test_collection.py b/tests/test_collection.py > index 62a8d0a..54434dd 100644 > --- a/tests/test_collection.py > +++ b/tests/test_collection.py > @@ -19,7 +19,7 @@ class TestCollection(CalypsoTestCase): > collection = Collection("") > self.assertTrue(collection.import_file(self.test_vcard)) > self.assertEqual(len(collection.items), 2) > - org = u'Universitetet i Tromsø' > + org = u'Universitetet i Tromsø'.encode('utf-8') > self.assertEquals(org, collection.items[0].object.org.value[0]) > > def test_remove_existent_item(self):
I have pushed these and other patches posted in April. Cheers, -- Guido _______________________________________________ Calypso mailing list [email protected] http://keithp.com/mailman/listinfo/calypso
