Handle edit resource requests.
427609
def edit_resource(self):
        
        self.mark_current_profile_as_pending()
        resource = None
        for item in self.resources_list.selectedItems()[:1]:
            resource = item.resource_full
            self.edit_item = item
        if not resource:
            return
        parameters_widget = [
            self.parameters_scrollarea.layout().itemAt(i) for i in
            range(self.parameters_scrollarea.layout().count())][0].widget()
        parameter_widgets = [
            parameters_widget.vertical_layout.itemAt(i).widget() for i in
            range(parameters_widget.vertical_layout.count())]
        parameter_widgets[0].set_text(resource['Resource name'])
        parameter_widgets[1].set_text(resource['Resource description'])
        parameter_widgets[2].set_text(resource['Unit'])
        parameter_widgets[3].set_text(resource['Units'])
        parameter_widgets[4].set_text(resource['Unit abbreviation'])
        parameter_widgets[5].set_value(float(resource['Default']))
        parameter_widgets[6].set_value(float(resource['Minimum allowed']))
        parameter_widgets[7].set_value(float(resource['Maximum allowed']))
        parameter_widgets[8].set_text(resource['Frequency'])
        parameter_widgets[9].set_text(resource['Readable sentence'])
        self.switch_context(self.resource_edit_page)
447483
def edit(self, request, id):
        """"""
        try:
            object = self.model.objects.get(id=id)
        except self.model.DoesNotExist:
            return self._render(
                request = request,
                template = '404',
                context = {
                    'error': 'The %s could not be found.' % self.model.__name__.lower()
                },
                status = 404,
                prefix_template_path = False
            )

        form = (self.form or generate_form(self.model))(instance=object)

        # Add "_method" field to override request method to PUT
        form.fields['_method'] = CharField(required=True, initial='PUT', widget=HiddenInput)

        return self._render(
            request = request,
            template = 'edit',
            context = {
                cc2us(self.model.__name__): object,
                'form': form
            },
            status = 200
        )
934523
async def handler(event):
    """"""
    q1 = event.pattern_match.group(1)
    q2 = urllib.parse.quote(q1)
    await asyncio.wait([
        event.delete(),
        event.respond(DOCS.format(q1, q2), reply_to=event.reply_to_msg_id)
    ])
674342
def post(method, hmc, uri, uri_parms, body, logon_required,
             wait_for_completion):
        """"""
        assert wait_for_completion is True  # async not supported yet
        try:
            resource = hmc.lookup_by_uri(uri)
        except KeyError:
            raise InvalidResourceError(method, uri)
        resource.update(body)
789899
def handle_request(self, request, **resources):
        
        if not request.method in self._meta.callmap.keys():
            raise HttpError(
                'Unknown or unsupported method \'%s\'' % request.method,
                status=status.HTTP_501_NOT_IMPLEMENTED)

        # Get the appropriate create/read/update/delete function
        view = getattr(self, self._meta.callmap[request.method])

        # Get function data
        return view(request, **resources)
749484
def update
      self.resource = find_resource
      
      respond_to do |format|
        if resource.update( resource_params )
          format.html { redirect_to resource_url, notice: "#{resource_name.humanize} was successfully updated." }
          format.js
          format.json { render :show, status: :ok, location: resource_url }
        else
          format.html { render :edit }
          format.js   { render :edit }
          format.json { render json: resource.errors, status: :unprocessable_entity }
        end
      end
    end
1136148
def edit(request):
    
    model = apps.get_model(request.POST["app"], request.POST["model"])
    obj = model.objects.get(id=request.POST["id"])
    form = get_edit_form(obj, request.POST["fields"], data=request.POST,
                         files=request.FILES)
    if not (is_editable(obj, request) and has_site_permission(request.user)):
        response = _("Permission denied")
    elif form.is_valid():
        form.save()
        model_admin = ModelAdmin(model, admin.site)
        message = model_admin.construct_change_message(request, form, None)
        model_admin.log_change(request, obj, message)
        response = ""
    else:
        response = list(form.errors.values())[0][0]
    return HttpResponse(response)
562228
def handler(self, environ, start_response):
        """"""

        if environ['REQUEST_METHOD'] == 'POST':
            return self.handle_POST(environ, start_response)
        else:
            start_response("400 Bad request", [('Content-Type', 'text/plain')])
            return ['']
651211
def edit_service(self, id_, **kwargs):
        
        data = self._wrap_dict("service", kwargs)
        return self.patch("/services/{}.json".format(id_), data=data)
488871
def edit_and_execute(event):
    
    buff = event.current_buffer

    buff.open_in_editor(event.cli)
    buff.accept_action.validate_and_handle(event.cli, buff)
980309
def update(self, request, *args, **kwargs):
        
        instance = self.get_object()
        if (not request.user.has_perm('edit_collection', instance.collection)
                and not request.user.is_superuser):
            return Response(status=status.HTTP_401_UNAUTHORIZED)

        return super().update(request, *args, **kwargs)
124002
def can_edit(self, user):
        """"""
        return self.class_.can_edit(user) and self.status != u'locked'
1265436
function editorUpdate() {
    if (editor.binding) {
      if ('hold' === generator.clientUpdateFragmentText(editor.binding, editor.$edit.val())) {
        editor.holding = true;
      }
    }
  }
1147774
def _edit_main(self, request):
        
        self.prefix = "{}_Pull_Request_{}".format(request.repo.name, request.pull.number)
        if not self.testmode:
            page = site.pages[self.basepage]
            text = page.text()
        else:
            text = "This is a fake wiki page.\n\n<!--@CI:Placeholder-->"
            
        self.newpage = self.prefix
        link = "Pull Request #{}".format(request.pull.number)
        text = text.replace("<!--@CI:Placeholder-->",
                            "* [[{}|{}]]\n<!--@CI:Placeholder-->".format(self.newpage, link))
        if not self.testmode:
            result = page.save(text, summary="Added {} unit test link.".format(link), minor=True, bot=True)
            return result[u'result'] == u'Success'
        else:
            return text
777929
def edit(self, **args):
        
        if self.model.exists(args["index"]):
            values = dict(zip(
                ['parent', 'name', 'priority', 'comment', 'done'],
                self.model.get(args["index"])
            ))
            kwargs = self.getKwargs(args, values)
            if kwargs:
                self.model.edit(args["index"], **kwargs)
237304
def handle_request(self):
        """"""
        try:
            request, client_address = self.get_request()
        except socket.error:
            return

        if self.verify_request(request, client_address):
            self.workerpool.run(self.process_request_thread,
                                **{'request': request,
                                   'client_address': client_address})
629235
def handle_404(request, exception):
    '''
    '''
    error = format_error(title='Resource not found', detail=str(exception))
    return json(return_an_error(error), status=HTTPStatus.NOT_FOUND)