outini/python-powerdns

Default return value of get_record

jschewebbn opened this issue · 3 comments

The default return value of get_record should probably be None. Instead of "" at https://github.com/outini/python-powerdns/blob/master/powerdns/interface.py#L244 this should be None. Then one can easily check if there is a valid return value.

hello,

The method get_record returns a list instance in any case not to have inconsistent return statements. I usually return None if the method is supposed to return a single instance of an object.

In this case, an empty list still allows one to easily know if records have been found by doing a simple test on the list instance, which will return False if empty.

if not zone.get_record("nonexistent"):
    print("no record have been found")

Did you have an issue with that ?

Regards

I see that get_record now has a a list as a default value, previously it did not. suggest_zone has a default value of the empty string instead of None, see https://github.com/outini/python-powerdns/blob/master/powerdns/interface.py#L248