<% from slowfoot import binderytools from merescoharvester.controlpanel.tools import checkName, getDomainId f = asform(input) repositoryId = f.id group = xml domainId = getDomainId(req.uri) groupFileName = args.name fileName = "%s.%s.repository"%(domainId, repositoryId) errorUrl = '/page/repositoryGroup.edit/'+groupFileName +'?error=' if repositoryId == '': redirect(errorUrl + 'No%20id%20given.') elif not checkName(repositoryId): redirect(errorUrl + 'Name%20is%20not%20valid.%20Only%20use%20alphanumeric%20characters.') elif os.path.isfile(filepath(fileName)): redirect(errorUrl +'A%20repository%20with%20this%20id%20already%20exists.') else: new_repository = binderytools.bind_string("""%s"""%(repositoryId)).repositoryId group.repositoryGroup.xml_append(new_repository) target(filepath(groupFileName)) req.write(group.xml()) target(filepath(fileName)) %> <%escape_xml(repositoryId)%> <%escape_xml(group.repositoryGroup.id)%> <% redirect('/page/repository.edit/' + fileName + '?referrerGroup=' + group.repositoryGroup.id) # %>