@require_POST
@csrf_protect
def generic_copy(request, what, obj_name=None, obj_newname=None):
 if (not test_user_authenticated(request)):
  return login(request, next=('/cobbler_web/%s/copy/%s/%s' % (what, obj_name, obj_newname)), expired=True)
 if (obj_name is None):
  return error_page(request, ('You must specify a %s to rename' % what))
 if (not remote.has_item(what, obj_name)):
  return error_page(request, ('Unknown %s specified' % what))
 elif (not remote.check_access_no_fail(request.session['token'], ('modify_%s' % what), obj_name)):
  return error_page(request, ('You do not have permission to copy this %s' % what))
 else:
  obj_id = remote.get_item_handle(what, obj_name, request.session['token'])
  remote.copy_item(what, obj_id, obj_newname, request.session['token'])
  return HttpResponseRedirect(('/cobbler_web/%s/list' % what))

@ require_POST @ csrf_protect def generic_copy ( request , what , obj_name = None , obj_newname = None ) : if ( not test_user_authenticated ( request ) ) : return login ( request , next = ( '/cobbler_web/%s/copy/%s/%s' % ( what , obj_name , obj_newname ) ) , expired = True ) if ( obj_name is None ) : return error_page ( request , ( 'You must specify a %s to rename' % what ) ) if ( not remote . has_item ( what , obj_name ) ) : return error_page ( request , ( 'Unknown %s specified' % what ) ) elif ( not remote . check_access_no_fail ( request . session [ 'token' ] , ( 'modify_%s' % what ) , obj_name ) ) : return error_page ( request , ( 'You do not have permission to copy this %s' % what ) ) else : obj_id = remote . get_item_handle ( what , obj_name , request . session [ 'token' ] ) remote . copy_item ( what , obj_id , obj_newname , request . session [ 'token' ] ) return HttpResponseRedirect ( ( '/cobbler_web/%s/list' % what ) )
copies an object .