summaryrefslogtreecommitdiff
path: root/dns/zone.py
Commit message (Collapse)AuthorAgeFilesLines
* simplify TTL check when reading a zone fileBob Halley2020-06-171-10/+7
|
* remove unneeded exception catching from rhs setting in $GENERATE code ↵Bob Halley2020-06-171-5/+2
| | | | (cut-and-paste issue)
* Minor Python 3 cleanups.Brian Wellington2020-06-031-2/+2
| | | | | | | Classes inherit from object by default; there's no need to explicitly include this. Replace super(Foo, self) with super().
* Remove dns.rdata{type,class}.to_enum.Brian Wellington2020-05-211-10/+10
| | | | | | | These methods (which convert a str/int into an enum/int) shouldn't be commonly used by external code, so don't need to exist at the module level. The make() method on the enum class (renamed from to_enum()) can still be used, and the internal callers have been updated to use it.
* Simplify exception handling.Brian Wellington2020-05-201-6/+6
|
* Start converting rdatatype/rdataclass to enum.Brian Wellington2020-05-181-20/+15
|
* flake8 lintingBob Halley2020-05-151-20/+12
|
* Fix documentation typos.Brian Wellington2020-05-111-1/+1
|
* more documentationBob Halley2020-05-091-229/+341
|
* IDNA support for zones, messages, names in rdata, rrsets, and rdatasets.Bob Halley2020-05-031-6/+10
|
* Use context managers to simplify code.Brian Wellington2020-05-011-41/+27
| | | | | | | | Simplify code using try/finally to use context managers. In some cases, contextlib.ExitStack() is used; this could probably be further simplified to use contextlib.nullcontext() once Python 3.7+ is a requirement.
* In library code, replace from io import BytesIO (or StringIO) with import ioBob Halley2020-05-011-4/+4
|
* Remove "from __future__ import" statements.Brian Wellington2020-05-011-2/+0
| | | | None of these are needed anymore.
* Merge pull request #431 from bwelling/zone-to-textBob Halley2020-03-201-2/+2
|\ | | | | zone.to_text() should return a string.
| * zone.to_text() should return a string.Brian Wellington2020-03-201-2/+2
| | | | | | | | | | | | As part of the Python 3 conversion, the result of dns.zone.to_text() changed from str to bytes. This was likely unintentional, as a method with text in its name should be returning text.
* | Add relativize_to to from_text().Brian Wellington2020-03-181-4/+4
|/ | | | | | | | | | | | | | | When calling from_text, the zone code needs to apply the current origin (which may or may not be the zone origin, if sub-zone $ORIGIN statements are present), and may also want to relativize the contents to the zone origin. Previously, this was done by explicitly reading records as absolute, and then relativizing them laster. With this change, the work is moved to the tokenizer. This gets rid of the remaining internal uses of dns.rdata.choose_relativity(), which prevents rdata from being immutable.
* Remove choose_relativity() from zone.from_xfr()Brian Wellington2020-03-181-1/+0
| | | | | | | | | | The comment states that relativize must be consistent between dns.query.xfr() and dns.zone.from_xfr(), and the code fails if they're not (if check_origin is True, at least). This means that the rdata is already correctly relativized (or not). This also adds a test of creating zones from xfrs, both relativized and not.
* MNT: use raw string literals for invalid escapesThomas A Caswell2019-10-301-3/+3
|
* Update zone.pytmerila2019-04-031-3/+3
| | | Check for self.last_ttl_known before setting ttl = self.last_ttl so it will remain None instead of 0 if value is not known.
* Update zone.pytmerila2019-04-031-1/+1
| | | Need to also check that last TTL is known before using it as a fallback, otherwise ttl is never None in the last check, setting it incorrectly to 0 instead.
* Update zone.pytmerila2019-04-031-12/+21
| | | Instead of moving the entire TTL parsing past the rdata handling (causing the RR to be parsed on the wrong way), returned the parsing to its original location, and only moved the final failure code past the rdata handling.
* Update zone.pytmerila2019-04-031-15/+17
| | | By doing the TTL validity check after parsing the record data allows the TTL to be set properly from SOA RDATA even when the SOA record itself does not have TTL set.
* $GENERATE was not padding correctly given a pattern like ${0,3} it wasBob Halley2019-02-211-1/+0
| | | | | using the index field (0) as the padding width, instead of the correct value 3.
* Fix exception when parsing certain generate statementsSigmund Augdal2019-02-211-2/+2
|
* remove the rest of the unicode string prefixesBob Halley2019-01-081-12/+12
|
* Remove _compat module.Bob Halley2018-12-091-33/+20
|
* delintBob Halley2018-12-011-3/+3
|
* update copyrightBob Halley2018-12-011-0/+2
|
* Upgrade Python syntax with pyupgrade https://github.com/asottile/pyupgradeHugo2018-09-061-1/+1
|
* Initial type signaturesJanus2018-07-311-2/+2
|
* Merge pull request #255 from tomlanyon/masterBob Halley2018-07-171-10/+48
|\ | | | | Improve TTL detection when reading master zone files.
| * Improve TTL detection when reading master zone files.Tom Lanyon2017-05-311-10/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This introduces the same behaviour that BIND has when it encounters implicit TTL values, namely: * The $TTL directive is preferred to set the default TTL [RFC2308]. * If no $TTL directive is seen prior to the SOA RR, the default TTL is set to the minimum TTL field of the SOA RR [RFC1033, RFC1035, RFC1912]. * If neither $TTL nor an SOA are present, use the last seen explicit TTL on an RR or raise a SyntaxError if no explicit TTLs have been seen. Previously, when neither $TTL nor SOA were present, the TTL for an RR without an explicit TTL would be set to 0 which is known to be a somewhat dangerous value and shouldn't be encouraged as a default. One test seems to rely on this default TTL=0 behaviour whilst testing something seemingly unrelated (RR starting with whitespace), so that test has been updated to match this new expectation. Fixes #254.
* | the universal newlines fix was backwardsBob Halley2018-02-211-2/+2
| |
* | Remove deprecated U option to open on python 3.Bob Halley2018-02-201-1/+4
| | | | | | | | [Issue #252]
* | delintBob Halley2018-02-201-5/+5
| |
* | Unify PY2/3 detectionMartin2017-07-191-6/+3
|/ | | | | | dns._compat module contains constants PY2 and PY3 which should be used for detection of python version, to have only one method and avoid duplications
* Merge pull request #197 from bastiak/pylintBob Halley2016-09-181-3/+3
|\ | | | | Pylint
| * Pylint: remove bare exceptsMartin2016-08-311-3/+3
| | | | | | | | Bare excepts should not be used, because they may hide system exceptions such as KeyboardInterupts or SystemExits.
* | Fix encoding errors zone.to_file()Martin2016-08-311-12/+26
|/ | | | | From the code it looks like the only 'wb' mode is supported after migration to py3. I fixed py3 with 'wb'. Both textual and binary modes should be supported now.
* Py3: do not use iter* methods with dictMartin2016-07-021-3/+12
|
* Pylint: NotImplementedErrorMartin Basti2016-06-271-1/+1
|
* Fix typosJakub Wilk2016-05-261-2/+2
|
* Allow an origin of None to be specified when constructing aBob Halley2016-05-111-7/+8
| | | | | Zone object. [issue #153]
* Allow zone origin to be specified as a string.Bob Halley2016-05-081-1/+8
|
* python3 supportArthur Gautier2016-04-211-72/+85
| | | | Signed-off-by: Arthur Gautier <baloo@gandi.net>
* Remove redundant 'pass' from class definitions.Petr Spacek2015-02-121-4/+0
|
* Amend doc strings for all DNSExceptions to make them suitable for direct ↵Petr Spacek2015-02-121-4/+4
| | | | printing.
* Add dns.zone.to_text() convenience method.Bob Halley2014-06-211-0/+25
| | | | Thanks to Brandon Whaley <redkrieg@gmail.com> for the patch.
* Fix exception when reading from a masterfile.Bob Halley2014-06-211-1/+1
| | | | | | | When reading from a masterfile, if the first content line started with leading whitespace, we raised an ugly exception instead of doing the right thing, namely using the zone origin as the name. [#73]
* Do not put back an unescaped token.Bob Halley2014-04-111-1/+1
|