def get_zone(zonename): '''Return a Zone instance for zonename that has been loaded from the actual zone file. If the zone file cannot be found or loaded, a redirect to "/" is raised. ''' z = Zone(zonename) zone_file = find_zone_file(zonedir, zonename) z.load_from_file(zone_file) return z
def get_archive(zonename, filename): '''Return a Zone instance for zonename that has been loaded from an archived zone file filename. If the zone file cannot be found or loaded, a redirect to "/" is raised. ''' z = Zone(zonename) if archive_dir is None: raise Exception("archive_dir is not not defined, please check the configuration") zone_file = find_zone_file(archive_dir, filename) if not zone_file: raise Exception("Archived zone file does not exist") z.load_from_file(zone_file) return z
def get_archive(zonename, filename): '''Return a Zone instance for zonename that has been loaded from an archived zone file filename. If the zone file cannot be found or loaded, a redirect to "/" is raised. ''' z = Zone(zonename) if archive_dir is None: raise Exception( "archive_dir is not not defined, please check the configuration") zone_file = find_zone_file(archive_dir, filename) if not zone_file: raise Exception("Archived zone file does not exist") z.load_from_file(zone_file) return z