%
from slowfoot import binderytools
execcode = '''upload.parts['metadata'] = input.metadata.xml()
upload.parts['header'] = input.header.xml()
upload.parts['meta'] = """
%(id)s
%(recordId)s
%(repository)s
%(set)s
%(baseurl)s
%(repositoryGroupId)s
%(metadataPrefix)s
%(collection)s
""" % dict([(k,xmlEscape(v)) for k,v in {
'id': upload.id,
'set': input.repository.set,
'baseurl': input.repository.baseurl,
'repositoryGroupId': input.repository.repositoryGroupId,
'repository': input.repository.id,
'metadataPrefix': input.repository.metadataPrefix,
'collection': input.repository.collection,
'recordId': input.header.identifier,
}.items()])
'''
description = """This mapping is what has become the default mapping for most Meresco based projects.
"""
f = asform(input)
name = f.name
domain = xml
if name == '':
redirect('/page/domain.edit/' + domain.domain.id + '.domain?error=No%20name%20given.')
else:
mappingid = uuid()
new_mapping = binderytools.bind_string("%s"%mappingid).mappingId
domain.domain.xml_append(new_mapping)
target(filepath(domain.domain.id + '.domain'))
req.write(domain.xml())
target(filepath(mappingid + ".mapping"))
%>
<%=mappingid%>
<%= name %>
<% escape_xml(execcode) %>
<% escape_xml(description) %>
<%
redirect(uri(path='/page/mapping.edit/' + mappingid + '.mapping', query={'referrerDomain':domain.domain.id}))
#
%>