Example #1
0
    def get_values(self):
        root = read_mapcache_xml(get_ngeo_config())
        try:
            template = root.xpath("auth_method[1]/template/text()")[0]
            baseurl = self.cmd_line_re.match(template).group("url")
        except (IndexError, AttributeError):
            baseurl = ""

        return {"baseurl": baseurl}
Example #2
0
    def get_values(self):
        root = read_mapcache_xml(get_ngeo_config())
        try:
            template = root.xpath("auth_method[1]/template/text()")[0]
            baseurl = self.cmd_line_re.match(template).group("url")
        except (IndexError, AttributeError):
            baseurl = ""

        return {"baseurl": baseurl}
Example #3
0
    def set_values(self, baseurl):
        config = get_ngeo_config()
        root = read_mapcache_xml(config)
        try:
            template_elem = root.xpath("auth_method[1]/template")[0]
            template = template_elem.text
        except IndexError:
            pass  # no template given?

        match = self.cmd_line_re.match(template)
        if match:
            template = "".join((match.string[:match.start("url")], baseurl,
                                match.string[match.end("url"):]))
        else:
            template += " --baseurl %s" % baseurl
        template_elem.text = template

        write_mapcache_xml(root, config)
Example #4
0
    def set_values(self, baseurl):
        config = get_ngeo_config()
        root = read_mapcache_xml(config)
        try:
            template_elem = root.xpath("auth_method[1]/template")[0]
            template = template_elem.text
        except IndexError:
            pass  # no template given?

        match = self.cmd_line_re.match(template)
        if match:
            template = "".join((
                match.string[:match.start("url")],
                baseurl, match.string[match.end("url"):]
            ))
        else:
            template += " --baseurl %s" % baseurl
        template_elem.text = template

        write_mapcache_xml(root, config)