Fix missing '/' in self link after zone import

* Also fixes content type

Change-Id: I585535a38acff7fc4d7552f693a941948442a30b
Closes-Bug: #1444008
This commit is contained in:
Graham Hayes 2015-04-14 17:24:05 +02:00
parent 35f83ceab3
commit e77c4645c6
1 changed files with 6 additions and 1 deletions

View File

@ -32,12 +32,17 @@ class ImportController(rest.RestController):
@pecan.expose(template='json:', content_type='application/json')
def post_all(self):
request = pecan.request
response = pecan.response
context = pecan.request.environ['context']
policy.check('zone_import', context)
if request.content_type != 'text/dns':
raise exceptions.UnsupportedContentType(
'Content-type must be text/dns')
try:
dnspython_zone = dnszone.from_text(
request.body,
@ -69,7 +74,7 @@ class ImportController(rest.RestController):
zone = DesignateAdapter.render('API_v2', zone, request=request)
zone['links']['self'] = '%s%s/%s' % (
zone['links']['self'] = '%s/%s/%s' % (
self.BASE_URI, 'v2/zones', zone['id'])
response.headers['Location'] = zone['links']['self']