Mercurial > treepkg
changeset 58:39b2deea8481
make the status files are world readable
author | Bernhard Herzog <bh@intevation.de> |
---|---|
date | Tue, 10 Apr 2007 17:42:46 +0200 |
parents | d0d08c7e7d37 |
children | 9cb94b9ac6a6 ee32f709a374 |
files | test/test_status.py treepkg/status.py |
diffstat | 2 files changed, 9 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/test/test_status.py Tue Apr 10 17:42:07 2007 +0200 +++ b/test/test_status.py Tue Apr 10 17:42:46 2007 +0200 @@ -8,6 +8,7 @@ """Tests for the Status classes""" import os +import stat import unittest from datetime import datetime @@ -35,6 +36,13 @@ otherstatus = RevisionStatus(self.filename) self.assertEquals(otherstatus.status.name, "error") + def test_status_file_permissions(self): + status = RevisionStatus(self.filename) + status.error() + + mode = os.stat(self.filename).st_mode + self.assertEquals(stat.S_IMODE(mode) & 0444, 0444) + def test_getting_unknown_fields(self): status = RevisionStatus(self.filename) self.assertRaises(AttributeError, getattr, status, "unknown_field")
--- a/treepkg/status.py Tue Apr 10 17:42:07 2007 +0200 +++ b/treepkg/status.py Tue Apr 10 17:42:46 2007 +0200 @@ -152,7 +152,7 @@ if field in self._values: lines.append("%s: %s\n" % (field, desc.serialize(self._values[field]))) - util.writefile(self._filename, "".join(lines)) + util.writefile(self._filename, "".join(lines), 0644) def __getattr__(self, attr): desc = self._fields.get(attr)