Mercurial > hgweb.cgi > hwm
changeset 16:80e4a7352cdd
Prevent configuration from being accidentally modified. IN: -
author | John Schneiderman <JohnMS@CodeGNU.com> |
---|---|
date | Sat, 26 Jul 2014 15:05:09 -0500 |
parents | 22a0c93c7c25 |
children | 1f4340543758 |
files | src/configuration.py |
diffstat | 1 files changed, 37 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/src/configuration.py Sat Jul 26 14:54:54 2014 -0500 +++ b/src/configuration.py Sat Jul 26 15:05:09 2014 -0500 @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# -*- coding: utf-8 -*- #******************************************************************************* #** This file is part of HgWeb Manager. *** #** *** @@ -29,14 +29,35 @@ """ Manages the configurations for HgWebManager """ # The configuration file parser. __parser = None - # The path and file name of the hg command. - HgCommand = None - # The base directory path for the HgWeb repositories. - RepositoryPath = None - # The base directory path to the HgWeb web-server. - HgWebPath = None + # The absolute directory path and file name of the hg command. + __hgCommand = None + # The absolute directory path to the managed HgWeb repositories. + __repositoryPath = None + # The absolute directory path to the HgWeb web-server. + __hgWebPath = None # The user-name of the Mercurial web-manager. - HgUser = None + __hgUser = None + + @property + def HgCommand(self): + """ Gets the command for executing mercurial. """ + return self.__hgCommand + + @property + def RepositoryPath(self): + """ Gets the directory path to the managed repositories. """ + return self.__repositoryPath + + @property + def HgWebPath(self): + """ Gets the directory path to the repository web-server. """ + return self.__hgWebPath + + @property + def HgUser(self): + """ Gets the user-name of the web-manager. """ + return self.__hgUser + def __init__(self, path = ['/etc/hwm.ini', '~/.hwm/hwm.ini', './hwm.ini']): """ Loads the settings values stored in the configuration file. @@ -48,18 +69,18 @@ if self.__parser.has_section('Mercurial'): if self.__parser.has_option('Mercurial', 'Base'): - self.RepositoryPath = self.__parser.get('Mercurial', 'Base') + self.__repositoryPath = self.__parser.get('Mercurial', 'Base') if self.__parser.has_option('Mercurial', 'Command'): - self.HgCommand = self.__parser.get('Mercurial', 'Command') + self.__hgCommand = self.__parser.get('Mercurial', 'Command') if self.__parser.has_option('Mercurial', 'User'): - self.HgUser = self.__parser.get('Mercurial', 'User') + self.__hgUser = self.__parser.get('Mercurial', 'User') if self.__parser.has_option('Mercurial', 'Web'): - self.HgWebPath = self.__parser.get('Mercurial', 'Web') + self.__hgWebPath = self.__parser.get('Mercurial', 'Web') else: - self.HgUser = "hg" - self.RepositoryPath = "/var/hg/repos" - self.HgCommand = "/usr/bin/hg" - self.HgWebPath = "/var/www/hgweb" + self.__hgUser = "hg" + self.__repositoryPath = "/var/hg/repos" + self.__hgCommand = "/usr/bin/hg" + self.__hgWebPath = "/var/www/hgweb"