[Calypso] [PATCH] Use item when possible, rather than collection.

Guido G├╝nther agx at sigxcpu.org
Wed Apr 13 23:07:39 PDT 2016


This obsoletes

    [Calypso] [PATCH] item and collection are not the same thing; use
    item when possible.

I assume?
 -- Guido

On Thu, Apr 14, 2016 at 01:03:18AM +0000, Jelmer Vernooij wrote:
> From: Jelmer Vernoo─│ <jelmer at jelmer.uk>
> 
> This matters, as item can represent a subcollection.
> ---
>  calypso/xmlutils.py | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/calypso/xmlutils.py b/calypso/xmlutils.py
> index 0715764..6d92658 100644
> --- a/calypso/xmlutils.py
> +++ b/calypso/xmlutils.py
> @@ -159,10 +159,10 @@ def propfind(path, xml_request, collection, depth, context):
>          for tag in props:
>              element = ET.Element(tag)
>              if tag == _tag("D", "resourcetype") and is_collection:
> -                if collection.is_calendar:
> +                if item.is_calendar:
>                      tag = ET.Element(_tag("C", "calendar"))
>                      element.append(tag)
> -                if collection.is_addressbook:
> +                if item.is_addressbook:
>                      tag = ET.Element(_tag("A", "addressbook"))
>                      element.append(tag)
>                  tag = ET.Element(_tag("D", "collection"))
> @@ -179,9 +179,9 @@ def propfind(path, xml_request, collection, depth, context):
>              elif tag == _tag("D", "getetag"):
>                  element.text = item.etag
>              elif tag == _tag("D", "displayname") and is_collection:
> -                element.text = collection.name
> +                element.text = item.name
>              elif tag == _tag("E", "calendar-color") and is_collection:
> -                element.text = collection.color
> +                element.text = item.color
>              elif tag == _tag("D", "principal-URL"):
>                  # TODO: use a real principal URL, read rfc3744-4.2 for info
>                  tag = ET.Element(_tag("D", "href"))
> @@ -223,7 +223,7 @@ def propfind(path, xml_request, collection, depth, context):
>                  element.append(tag)
>              elif tag in (_tag("A", "addressbook-description"),
>                           _tag("C", "calendar-description")) and is_collection:
> -                element.text = collection.get_description()
> +                element.text = item.get_description()
>              prop.append(element)
>  
>          status = ET.Element(_tag("D", "status"))
> -- 
> 2.8.0.rc3
> 
> _______________________________________________
> Calypso mailing list
> Calypso at keithp.com
> http://keithp.com/mailman/listinfo/calypso


More information about the Calypso mailing list