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:
parent
61e754c65e
commit
644b9f0bb9
@ -32,6 +32,7 @@ class BaseRepository(CustomConfig.ConfigHelperMixin, object):
|
|||||||
self.name = reposname
|
self.name = reposname
|
||||||
self.localeval = account.getlocaleval()
|
self.localeval = account.getlocaleval()
|
||||||
self._accountname = self.account.getname()
|
self._accountname = self.account.getname()
|
||||||
|
self._readonly = self.getconfboolean('readonly', False)
|
||||||
self.uiddir = os.path.join(self.config.getmetadatadir(), 'Repository-' + self.name)
|
self.uiddir = os.path.join(self.config.getmetadatadir(), 'Repository-' + self.name)
|
||||||
if not os.path.exists(self.uiddir):
|
if not os.path.exists(self.uiddir):
|
||||||
os.mkdir(self.uiddir, 0o700)
|
os.mkdir(self.uiddir, 0o700)
|
||||||
@ -108,6 +109,11 @@ class BaseRepository(CustomConfig.ConfigHelperMixin, object):
|
|||||||
def getconfig(self):
|
def getconfig(self):
|
||||||
return self.config
|
return self.config
|
||||||
|
|
||||||
|
@property
|
||||||
|
def readonly(self):
|
||||||
|
"""Is the repository readonly?"""
|
||||||
|
return self._readonly
|
||||||
|
|
||||||
def getlocaleval(self):
|
def getlocaleval(self):
|
||||||
return self.account.getlocaleval()
|
return self.account.getlocaleval()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user