From 644b9f0bb9ce1f0b60cd4814162c8029e452cbc9 Mon Sep 17 00:00:00 2001 From: Sebastian Spaeth Date: Tue, 8 May 2012 16:31:19 +0200 Subject: [PATCH] Implement .readonly property for repositories Set the value once on repository initialization to centralize the default value. Signed-off-by: Sebastian Spaeth --- offlineimap/repository/Base.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/offlineimap/repository/Base.py b/offlineimap/repository/Base.py index 606294e..61cdc75 100644 --- a/offlineimap/repository/Base.py +++ b/offlineimap/repository/Base.py @@ -32,6 +32,7 @@ class BaseRepository(CustomConfig.ConfigHelperMixin, object): self.name = reposname self.localeval = account.getlocaleval() self._accountname = self.account.getname() + self._readonly = self.getconfboolean('readonly', False) self.uiddir = os.path.join(self.config.getmetadatadir(), 'Repository-' + self.name) if not os.path.exists(self.uiddir): os.mkdir(self.uiddir, 0o700) @@ -108,6 +109,11 @@ class BaseRepository(CustomConfig.ConfigHelperMixin, object): def getconfig(self): return self.config + @property + def readonly(self): + """Is the repository readonly?""" + return self._readonly + def getlocaleval(self): return self.account.getlocaleval()