On Wed, Jan 13, 2016 at 02:22:27AM +0000, Jelmer Vernooij wrote: > From: Jelmer Vernooij <[email protected]> > > See RFC4791, par 5.2.1. > --- > calypso/webdav.py | 7 +++++++ > calypso/xmlutils.py | 7 +++---- > 2 files changed, 10 insertions(+), 4 deletions(-) > > diff --git a/calypso/webdav.py b/calypso/webdav.py > index b533a57..238067a 100644 > --- a/calypso/webdav.py > +++ b/calypso/webdav.py > @@ -232,6 +232,13 @@ class CalypsoError(Exception): > class Collection(object): > """Internal collection class.""" > > + def get_description(self): > + f = codecs.open(os.path.join(self.path, ".git/description"), > encoding='utf-8') > + try: > + return f.read() > + finally: > + f.close() > + > def read_file(self, path): > text = codecs.open(path,encoding='utf-8').read() > item = Item(text, None, path) > diff --git a/calypso/xmlutils.py b/calypso/xmlutils.py > index 3dfbcff..f9d73d7 100644 > --- a/calypso/xmlutils.py > +++ b/calypso/xmlutils.py > @@ -218,10 +218,9 @@ def propfind(path, xml_request, collection, depth, > context): > tag = ET.Element(_tag("D", "href")) > tag.text = config.get("server", "user_principal") % context > element.append(tag) > - elif tag == _tag("A", "addressbook-description") and > is_collection: > - element.text = collection.read_file(".git/description") > - elif tag == _tag("C", "calendar-description") and is_collection: > - element.text = collection.read_file(".git/description") > + elif tag in (_tag("A", "addressbook-description"), > + _tag("C", "calendar-description")) and > is_collection: > + element.text = collection.get_description() > prop.append(element) > > status = ET.Element(_tag("D", "status"))
ACK. Pease apply. Cheers, -- Guido _______________________________________________ Calypso mailing list [email protected] http://keithp.com/mailman/listinfo/calypso
