Implement .readonly property for repositories

Set the value once on repository initialization to centralize the
default value.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
This commit is contained in:
Sebastian Spaeth 2012-05-08 16:31:19 +02:00
parent 61e754c65e
commit 644b9f0bb9

View File

@ -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()