mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2025-01-07 19:05:39 +00:00
Merge branch 'master' into url_for_static_assets
This commit is contained in:
commit
73c267848c
@ -14,6 +14,11 @@ from .setting import Setting
|
|||||||
from .domain import Domain
|
from .domain import Domain
|
||||||
from .domain_setting import DomainSetting
|
from .domain_setting import DomainSetting
|
||||||
|
|
||||||
|
def byRecordContent(e):
|
||||||
|
return e['content']
|
||||||
|
|
||||||
|
def byRecordContentPair(e):
|
||||||
|
return e[0]['content']
|
||||||
|
|
||||||
class Record(object):
|
class Record(object):
|
||||||
"""
|
"""
|
||||||
@ -60,7 +65,14 @@ class Record(object):
|
|||||||
.format(e))
|
.format(e))
|
||||||
return []
|
return []
|
||||||
|
|
||||||
return jdata['rrsets']
|
rrsets=[]
|
||||||
|
for r in jdata['rrsets']:
|
||||||
|
while len(r['comments'])<len(r['records']):
|
||||||
|
r['comments'].append({"content":"", "account":""})
|
||||||
|
r['records'], r['comments'] = (list(t) for t in zip(*sorted(zip(r['records'],r['comments']),key=byRecordContentPair)))
|
||||||
|
rrsets.append(r)
|
||||||
|
|
||||||
|
return rrsets
|
||||||
|
|
||||||
def add(self, domain_name, rrset):
|
def add(self, domain_name, rrset):
|
||||||
"""
|
"""
|
||||||
@ -131,6 +143,11 @@ class Record(object):
|
|||||||
for r in rrsets[1:]:
|
for r in rrsets[1:]:
|
||||||
rrest['records'] = rrest['records'] + r['records']
|
rrest['records'] = rrest['records'] + r['records']
|
||||||
rrest['comments'] = rrest['comments'] + r['comments']
|
rrest['comments'] = rrest['comments'] + r['comments']
|
||||||
|
while len(rrest['comments'])<len(rrest['records']):
|
||||||
|
rrest['comments'].append({"content":"", "account":""})
|
||||||
|
zipped_list = zip(rrest['records'],rrest['comments'])
|
||||||
|
tuples = zip(*sorted(zipped_list,key=byRecordContentPair))
|
||||||
|
rrest['records'], rrest['comments'] = [list(t) for t in tuples]
|
||||||
return rrest
|
return rrest
|
||||||
|
|
||||||
def build_rrsets(self, domain_name, submitted_records):
|
def build_rrsets(self, domain_name, submitted_records):
|
||||||
@ -185,7 +202,10 @@ class Record(object):
|
|||||||
record_comments = [{
|
record_comments = [{
|
||||||
"content": record["record_comment"],
|
"content": record["record_comment"],
|
||||||
"account": ""
|
"account": ""
|
||||||
}] if record.get("record_comment") else []
|
}] if record.get("record_comment") else [{
|
||||||
|
"content": "",
|
||||||
|
"account": ""
|
||||||
|
}]
|
||||||
|
|
||||||
# Add the formatted record to rrsets list
|
# Add the formatted record to rrsets list
|
||||||
rrsets.append({
|
rrsets.append({
|
||||||
@ -237,7 +257,8 @@ class Record(object):
|
|||||||
# comparison between current and submitted rrsets
|
# comparison between current and submitted rrsets
|
||||||
for r in current_rrsets:
|
for r in current_rrsets:
|
||||||
for comment in r['comments']:
|
for comment in r['comments']:
|
||||||
del comment['modified_at']
|
if 'modified_at' in comment:
|
||||||
|
del comment['modified_at']
|
||||||
|
|
||||||
# List of rrsets to be added
|
# List of rrsets to be added
|
||||||
new_rrsets = {"rrsets": []}
|
new_rrsets = {"rrsets": []}
|
||||||
|
@ -99,14 +99,17 @@ def domain(domain_name):
|
|||||||
# PDA jinja2 template can understand.
|
# PDA jinja2 template can understand.
|
||||||
index = 0
|
index = 0
|
||||||
for record in r['records']:
|
for record in r['records']:
|
||||||
|
if (len(r['comments'])>index):
|
||||||
|
c=r['comments'][index]['content']
|
||||||
|
else:
|
||||||
|
c=''
|
||||||
record_entry = RecordEntry(
|
record_entry = RecordEntry(
|
||||||
name=r_name,
|
name=r_name,
|
||||||
type=r['type'],
|
type=r['type'],
|
||||||
status='Disabled' if record['disabled'] else 'Active',
|
status='Disabled' if record['disabled'] else 'Active',
|
||||||
ttl=r['ttl'],
|
ttl=r['ttl'],
|
||||||
data=record['content'],
|
data=record['content'],
|
||||||
comment=r['comments'][index]['content']
|
comment=c,
|
||||||
if r['comments'] else '',
|
|
||||||
is_allowed_edit=True)
|
is_allowed_edit=True)
|
||||||
index += 1
|
index += 1
|
||||||
records.append(record_entry)
|
records.append(record_entry)
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
<body class="hold-transition skin-blue sidebar-mini {% if not SETTING.get('fullscreen_layout') %}layout-boxed{% endif %}">
|
<body class="hold-transition skin-blue sidebar-mini {% if not SETTING.get('fullscreen_layout') %}layout-boxed{% endif %}">
|
||||||
{% if OFFLINE_MODE %}
|
{% if OFFLINE_MODE %}
|
||||||
{% set gravatar_url = "{{ url_for('static', filename='img/gravatar.png') }}" %}
|
{% set gravatar_url = "{{ url_for('static', filename='img/gravatar.png') }}" %}
|
||||||
{% else %}
|
{% elif current_user.email is defined %}
|
||||||
{% set gravatar_url = current_user.email|email_to_gravatar_url(size=80) %}
|
{% set gravatar_url = current_user.email|email_to_gravatar_url(size=80) %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
|
Loading…
Reference in New Issue
Block a user