<html><head></head><body>LGTM<br><br><div class="gmail_quote">On 3 February 2016 22:37:07 GMT+00:00, chrysn <chrysn@fsfe.org> wrote:<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">.git/description is absent, for example, when several (or all)<br />collections are stored in a combined git repository.<br /><br />in order to have a sensible default for descriptions, collections now<br />retain their url paths (previously, only the absolute file system path<br />was stored).<br />---<br /> calypso/<a href="http://webdav.py">webdav.py</a> | 10 ++++++----<br /> 1 file changed, 6 insertions(+), 4 deletions(-)<br /><br />diff --git a/calypso/<a href="http://webdav.py">webdav.py</a> b/calypso/<a href="http://webdav.py">webdav.py</a><br />index f6b84ab..12a9817 100644<br />--- a/calypso/<a href="http://webdav.py">webdav.py</a><br />+++ b/calypso/<a href="http://webdav.py">webdav.py</a><br />@@ -233,11 +233,12 @@ class Collection(object):<br /> """Internal collection class."""<br /> <br /> def get_description(self):<br />- f = codecs.open(os.path.join(self.path, ".git/description"), encoding='utf-8')<br /> try:<br />-
return f.read()<br />- finally:<br />- f.close()<br />+ f = codecs.open(os.path.join(self.path, ".git/description"), encoding='utf-8')<br />+ except IOError:<br />+ # .git/description is not present eg when the complete server is a single git repo<br />+ return self.urlpath<br />+ return f.read()<br /> <br /> def read_file(self, path):<br /> text = codecs.open(path,encoding='utf-8').read()<br />@@ -304,6 +305,7 @@ class Collection(object):<br /> <br /> self.log = logging.getLogger(__name__)<br /> self.encoding = "utf-8"<br />+ self.urlpath = path<br /> self.owner = paths.url_to_owner(path)<br /> self.path = paths.url_to_file(path)<br /> self.pattern = os.path.join(self.path, "*")</pre></blockquote></div></body></html>