def __call__(self, context):
     """
     """
     config_path = os.path.normpath(get_config_path())
     config_file = open(config_path, 'r')
     config_parser = ConfigParser()
     try:
         config_parser.readfp(config_file)
     except ParsingError, e:
         message = _(u"Error when trying to parse '%s'" % config_path)
         messages = IStatusMessage(context.context.request)
         messages.addStatusMessage(_(e.message), type='error')
         return SimpleVocabulary([])
Ejemplo n.º 2
0
 def __call__(self, context):
     """
     """
     config_path = os.path.normpath(get_config_path())
     config_file = open(config_path, 'r')
     config_parser = ConfigParser()
     try:
         config_parser.readfp(config_file)
     except ParsingError, e:
         message = _(u"Error when trying to parse '%s'" % config_path)
         messages = IStatusMessage(context.context.request)
         messages.addStatusMessage(_(e.message), type='error')
         return SimpleVocabulary([])
Ejemplo n.º 3
0
 def _read_config(self, section):
     """
     Read config from .ini file.
     """
     # get path to config file and read it
     config_path = os.path.normpath(get_config_path())
     config_file = open(config_path, "r")
     # parse file in ConfigParser
     self.config = ConfigParser()
     try:
         self.config.readfp(config_file)
     except ParsingError, e:
         log.exception("Error when trying to parse '%s'" % config_path)
         return
    def _locked_on_save(self, data):
        """
        Do static deployment.
        """
        messages = IStatusMessage(self.request)
        username = getToolByName(self.context, 'portal_membership').getMemberInfo().get('username', '')

        config_path = os.path.normpath(get_config_path())
        config_file = open(config_path, 'r')
        config_parser = ConfigParser()
        try:
            config_parser.readfp(config_file)
        except ParsingError, e:
            message = _(u"Error when trying to parse '%s'" % config_path)
            messages.addStatusMessage(message, type='error')
            return
Ejemplo n.º 5
0
    def _locked_on_save(self, data):
        """
        Do static deployment.
        """
        messages = IStatusMessage(self.request)
        username = getToolByName(self.context,
                                 'portal_membership').getMemberInfo().get(
                                     'username', '')

        config_path = os.path.normpath(get_config_path())
        config_file = open(config_path, 'r')
        config_parser = ConfigParser()
        try:
            config_parser.readfp(config_file)
        except ParsingError, e:
            message = _(u"Error when trying to parse '%s'" % config_path)
            messages.addStatusMessage(message, type='error')
            return