class CreateConfig models Manager def prepare self domains super Creat

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
class CreateConfig(models.Manager):
def prepare(self):
domains = super(CreateConfig, self).get_query_set()
named_conf = open("named.conf", "w")
for domain in domains:
named_conf.write(""" options {
directory %s;
dump-file %s;
statistics-file %s
}\n\
""" % (settings.BIND_OPTIONS['BASE_DIR'], settings.BIND_OPTIONS['DUMP_FILE'], settings.BIND_OPTIONS['STATISTICS_FILE']))
named_conf.close()