[Calypso] [PATCH 02/35] Add support for addressbook-description and calendar-description attributes.
Guido Günther
agx at sigxcpu.org
Sun Jan 10 09:23:06 PST 2016
Hi,
On Sat, Jan 09, 2016 at 06:56:31PM +0000, Jelmer Vernooij wrote:
> From: Jelmer Vernooij <jelmer at samba.org>
>
> See RFC4791, par 5.2.1.
> ---
> calypso/webdav.py | 7 +++++++
> calypso/xmlutils.py | 3 +++
> 2 files changed, 10 insertions(+)
>
> 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 47c9846..9e6783b 100644
> --- a/calypso/xmlutils.py
> +++ b/calypso/xmlutils.py
> @@ -218,6 +218,9 @@ def propfind(path, xml_request, collection, depth, context):
> 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()
We have then _tag("C", "calendar-description") twice now. From the new
code and just above (reading .git/description as well). Shouldn't we
just drop line 219-220?
Cheers,
-- Guido
> prop.append(element)
>
> status = ET.Element(_tag("D", "status"))
> --
> 2.7.0.rc3
>
> _______________________________________________
> Calypso mailing list
> Calypso at keithp.com
> http://keithp.com/mailman/listinfo/calypso
More information about the Calypso
mailing list