mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-11-09 23:20:27 +00:00
Add try block into domain.get_id_by_name function
If we try to check if a domain exists, and we fetch with get_id_by_name() function it will return with None if the domain not exists, and return the id when yes.
This commit is contained in:
parent
88f0faa73b
commit
bbb71f401c
@ -477,8 +477,11 @@ class Domain(db.Model):
|
||||
"""
|
||||
Return domain id
|
||||
"""
|
||||
domain = Domain.query.filter(Domain.name==name).first()
|
||||
return domain.id
|
||||
try:
|
||||
domain = Domain.query.filter(Domain.name==name).first()
|
||||
return domain.id
|
||||
except:
|
||||
return None
|
||||
|
||||
def update(self):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user