re-read the mapping file for every access
This commit is contained in:
parent
ac804b286c
commit
5e06806d40
1 changed files with 5 additions and 5 deletions
10
htman.py
10
htman.py
|
@ -58,14 +58,14 @@ def show_files():
|
||||||
# The template expects a list of tuples: (mapping name, admin-url).
|
# The template expects a list of tuples: (mapping name, admin-url).
|
||||||
# We assume, that the admin-url is just below the main admin URL. Thus
|
# We assume, that the admin-url is just below the main admin URL. Thus
|
||||||
# there is no need for generating a specific URL.
|
# there is no need for generating a specific URL.
|
||||||
all_zones = mapping.keys()
|
all_zones = get_mapping().keys()
|
||||||
all_zones.sort()
|
all_zones.sort()
|
||||||
values["mapping"] = [(zone_name, "%s%s/%s" % (web_defaults["base_url"], "admin/manage", zone_name)) for zone_name in all_zones]
|
values["mapping"] = [(zone_name, "%s%s/%s" % (web_defaults["base_url"], "admin/manage", zone_name)) for zone_name in all_zones]
|
||||||
return render("list_mappings.html", **values)
|
return render("list_mappings.html", **values)
|
||||||
|
|
||||||
@bobo.query('/manage')
|
@bobo.query('/manage')
|
||||||
def show_htpasswd(htname=None):
|
def show_htpasswd(htname=None):
|
||||||
if (htname is None) or (not htname in mapping) or (not re.match(REGEX["mapping"], htname)):
|
if (htname is None) or (not htname in get_mapping()) or (not re.match(REGEX["mapping"], htname)):
|
||||||
return bobo.redirect(web_defaults["base_url"])
|
return bobo.redirect(web_defaults["base_url"])
|
||||||
else:
|
else:
|
||||||
# do a redirect: this allows the webserver to check the permissions for this URL
|
# do a redirect: this allows the webserver to check the permissions for this URL
|
||||||
|
@ -79,7 +79,7 @@ def manage_htpasswd(htname=None, action=None, username=None, password=None):
|
||||||
values = web_defaults.copy()
|
values = web_defaults.copy()
|
||||||
values["error"] = None
|
values["error"] = None
|
||||||
values["success"] = None
|
values["success"] = None
|
||||||
if (htname is None) or (not htname in mapping) or (not re.match(REGEX["mapping"], htname)):
|
if (htname is None) or (not htname in get_mapping()) or (not re.match(REGEX["mapping"], htname)):
|
||||||
return bobo.redirect(web_defaults["base_url"])
|
return bobo.redirect(web_defaults["base_url"])
|
||||||
values["htname"] = htname
|
values["htname"] = htname
|
||||||
htpasswd_file = get_htpasswd_filename(htname)
|
htpasswd_file = get_htpasswd_filename(htname)
|
||||||
|
@ -145,7 +145,7 @@ def get_config():
|
||||||
print >>sys.stderr, "Failed to load config file from %s" % str(CONFIG_FILE_LOCATIONS)
|
print >>sys.stderr, "Failed to load config file from %s" % str(CONFIG_FILE_LOCATIONS)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
def get_mapping(config):
|
def get_mapping():
|
||||||
try:
|
try:
|
||||||
mapping_file = config.get("Locations", "mapping")
|
mapping_file = config.get("Locations", "mapping")
|
||||||
except ConfigParser.NoOptionError:
|
except ConfigParser.NoOptionError:
|
||||||
|
@ -210,7 +210,7 @@ def render(filename, input_data=None, **values):
|
||||||
# *** Initialization ***
|
# *** Initialization ***
|
||||||
config = get_config()
|
config = get_config()
|
||||||
# defaults to the standard TEMPLATES_DIR
|
# defaults to the standard TEMPLATES_DIR
|
||||||
mapping = get_mapping(config)
|
mapping = get_mapping()
|
||||||
templates_dir = get_templates_dir(config)
|
templates_dir = get_templates_dir(config)
|
||||||
web_defaults = dict(config.items("Web"))
|
web_defaults = dict(config.items("Web"))
|
||||||
loader = genshi.template.TemplateLoader([templates_dir], auto_reload=False)
|
loader = genshi.template.TemplateLoader([templates_dir], auto_reload=False)
|
||||||
|
|
Loading…
Reference in a new issue