1
0
mirror of https://github.com/oskar456/dzonegit.git synced 2024-05-11 05:55:41 +00:00

Add allowfancynames option

This commit is contained in:
Ondřej Caletka
2018-08-20 13:07:52 +02:00
parent 9923df14b7
commit 03cf26bbbe
3 changed files with 9 additions and 3 deletions

View File

@ -173,15 +173,15 @@ def get_zone_origin(zonedata):
def get_zone_name(path, zonedata):
"""
Try to guess zone name from either filename or the first $ORIGIN.
Throw a HookException if filename and zone ORIGIN differ more than
in slashes.
Unless disabled, throw a HookException if filename and zone ORIGIN differ
more than in slashes.
"""
stemname = Path(path).stem.lower()
originname = get_zone_origin(zonedata)
if originname:
tt = str.maketrans("", "", "/_,:-+*%^&#$")
sn, on = [s.translate(tt) for s in [stemname, originname]]
if sn != on:
if sn != on and not get_config("dzonegit.allowfancynames", bool):
raise HookException(
"Zone origin {o} differs from zone file.".format(o=originname),
fname=path,