[Calypso] [PATCH] fix description in absence of .git/description, Collection.urlpath
Jelmer Vernooij
jelmer at samba.org
Wed Feb 3 15:24:02 PST 2016
LGTM
On 3 February 2016 22:37:07 GMT+00:00, chrysn <chrysn at fsfe.org> wrote:
>.git/description is absent, for example, when several (or all)
>collections are stored in a combined git repository.
>
>in order to have a sensible default for descriptions, collections now
>retain their url paths (previously, only the absolute file system path
>was stored).
>---
> calypso/webdav.py | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
>diff --git a/calypso/webdav.py b/calypso/webdav.py
>index f6b84ab..12a9817 100644
>--- a/calypso/webdav.py
>+++ b/calypso/webdav.py
>@@ -233,11 +233,12 @@ 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()
>+ f = codecs.open(os.path.join(self.path,
>".git/description"), encoding='utf-8')
>+ except IOError:
>+ # .git/description is not present eg when the complete
>server is a single git repo
>+ return self.urlpath
>+ return f.read()
>
> def read_file(self, path):
> text = codecs.open(path,encoding='utf-8').read()
>@@ -304,6 +305,7 @@ class Collection(object):
>
> self.log = logging.getLogger(__name__)
> self.encoding = "utf-8"
>+ self.urlpath = path
> self.owner = paths.url_to_owner(path)
> self.path = paths.url_to_file(path)
> self.pattern = os.path.join(self.path, "*")
>--
>2.7.0
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Calypso mailing list
>Calypso at keithp.com
>http://keithp.com/mailman/listinfo/calypso
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://keithp.com/pipermail/calypso/attachments/20160203/08d33cd7/attachment-0001.html>
More information about the Calypso
mailing list