def clone_design(request, design_id):
 design = authorized_get_design(request, design_id)
 if (design is None):
  LOG.error(('Cannot clone non-existent design %s' % (design_id,)))
  return list_designs(request)
 copy = design.clone(request.user)
 copy.save()
 name = (copy.name + '-copy')
 design.doc.get().copy(content_object=copy, name=name, owner=request.user)
 messages.info(request, (_('Copied design: %(name)s') % {'name': design.name}))
 return format_preserving_redirect(request, reverse((get_app_name(request) + ':execute_design'), kwargs={'design_id': copy.id}))

def clone_design ( request , design_id ) : design = authorized_get_design ( request , design_id ) if ( design is None ) : LOG . error ( ( 'Cannot clone non-existent design %s' % ( design_id , ) ) ) return list_designs ( request ) copy = design . clone ( request . user ) copy . save ( ) name = ( copy . name + '-copy' ) design . doc . get ( ) . copy ( content_object = copy , name = name , owner = request . user ) messages . info ( request , ( _ ( 'Copied design: %(name)s' ) % { 'name' : design . name } ) ) return format_preserving_redirect ( request , reverse ( ( get_app_name ( request ) + ':execute_design' ) , kwargs = { 'design_id' : copy . id } ) )
clone a design belonging to any user .