From: Stefan Schantl Date: Tue, 2 Oct 2012 18:00:16 +0000 (+0200) Subject: Fix wrong-used docstrings in backend file. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=259f19afa460b5ee553c691bd508ad6eeb266788;p=people%2Fstevee%2Fpypdns.git Fix wrong-used docstrings in backend file. --- diff --git a/backend.py b/backend.py index d21cb59..7095eca 100644 --- a/backend.py +++ b/backend.py @@ -31,16 +31,25 @@ import database DB = "/var/lib/pdns/pdns.db" # Create the primary DNS class. -"""Use Database class from imported database module to connect to the PDNS sqlite database.""" class DNS(object): +""" +Primary DNS class. + +Uses the database class from imported database module. +Connects to the PDNS sqlite database. +""" def __init__(self, db): self.db = database.Database(db) # Get all configured domains. def get_domains(self): + """ + Fetch all configured domains. + """ + # Create an empty list. domains = [] - """Fetch all configured domains, line by line and add them to the previous created empty list.""" + # Add fetched domains to the previous created empty list. for row in self.db.query("SELECT id FROM domains"): domain = Domain(self, row.id) domains.append(domain) @@ -49,6 +58,9 @@ class DNS(object): # Get a domain by it's name. def get_domain(self, name): + """ + Get a domain by a given name. + """ row = self.db.get("SELECT id FROM domains WHERE name = ?", name) # Only do anything, if there is an existing domain. @@ -58,9 +70,13 @@ class DNS(object): return domain # Create Domain class. -"""Use query method from database module to get all requested information about our domain.""" -"""The domain is specified by it's unique id.""" class Domain(object): +""" +Domain class. + +Uses query method from database module to get requested information from domain. +The domain is specified by it's unique database id. +""" def __init__(self, dns, domain_id): self.dns = dns self.id = domain_id @@ -108,9 +124,13 @@ class Domain(object): # Get all records from zone. @property def records(self): + """ + Get all records from the zone. + """ + # Create an empty list. records = [] - """Fetch all records from domain, line by line and add them to the previous created empty list.""" + # Fetch records from zone and categorize them into their different record types. for row in self.db.query("SELECT id, type FROM records WHERE domain_id = ?", self.id): if row.type == "SOA": record = SOARecord(self, row.id) @@ -140,9 +160,13 @@ class Domain(object): # Create class for domain records. -"""It is used to get more details about the configured records.""" -"""The domain is specified by it's unique id.""" class Record(object): +""" +Record class + +It is used to get details about configured records. +The domain and record is's are specified by their unique database id's. +""" def __init__(self, domain, record_id): self.domain = domain self.id = record_id @@ -203,8 +227,14 @@ class Record(object): # Create an own class to deal with "SOA" records. -"""Use splitt() to generate a list of the original content string from the database, and return the requested entries.""" class SOARecord(Record): +""" +SOA Record class. +This is an own class to deal with "SOA" records. + +Uses splitt() to generate a list of the content string from the database. +Returns the requested entries. +""" def __init__(self, domain, record_id): Record.__init__(self, domain, record_id)