Skip to content

Commit

Permalink
Merge remote-tracking branch 'mind04/template-relative'
Browse files Browse the repository at this point in the history
  • Loading branch information
ngoduykhanh committed Apr 13, 2018
2 parents 8b7653a + df9e392 commit 01a5528
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/lib/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def display_record_name(data):
if record_name == domain_name:
return '@'
else:
return record_name.replace('.'+domain_name, '')
return re.sub('\.{}$'.format(domain_name), '', record_name)


def display_master_name(data):
Expand Down
2 changes: 1 addition & 1 deletion app/templates/admin_history.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ <h4 class="modal-title">Confirmation</h4>
<div class="modal-footer">
<button type="button" class="btn btn-flat btn-default pull-left"
data-dismiss="modal">Close</button>
<button type="button" class="btn btn-flat btn-danger" onclick="applyChanges('', $SCRIPT_ROOT + '/admin/history');location.reload();">Clear History</button>
<button type="button" class="btn btn-flat btn-danger" onclick="applyChanges('', $SCRIPT_ROOT + '/admin/history', false, true);">Clear History</button>
</div>
</div>
<!-- /.modal-content -->
Expand Down
5 changes: 3 additions & 2 deletions app/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -937,17 +937,18 @@ def create_template_from_zone():

if NEW_SCHEMA:
for jr in jrecords:
name = '@' if jr['name'] == domain_name else jr['name']
if jr['type'] in app.config['RECORDS_ALLOW_EDIT']:
name = '@' if jr['name'] == domain_name else re.sub('\.{}$'.format(domain_name), '', jr['name'])
for subrecord in jr['records']:

record = DomainTemplateRecord(name=name, type=jr['type'], status=True if subrecord['disabled'] else False, ttl=jr['ttl'], data=subrecord['content'])
records.append(record)
else:
for jr in jrecords:
if jr['type'] in app.config['RECORDS_ALLOW_EDIT']:
name = '@' if jr['name'] == domain_name else re.sub('\.{}$'.format(domain_name), '', jr['name'])
record = DomainTemplateRecord(name=name, type=jr['type'], status=True if jr['disabled'] else False, ttl=jr['ttl'], data=jr['content'])
records.append(record)

result_records = t.replace_records(records)

if result_records['status'] == 'ok':
Expand Down

0 comments on commit 01a5528

Please sign in to comment.