Exemplo n.º 1
0
    def put(self, context_gus, *uriargs):
        """
        Request: adminContextDesc
        Response: adminContextDesc
        Errors: InvalidInputFormat, ContextGusNotFound, ReceiverGusNotFound
        """

        try:
            request = validateMessage(self.request.body, requests.adminContextDesc)

            context_iface = Context()
            yield context_iface.update(context_gus, request)

            # 'receivers' it's a relationship between two tables, and is managed 
            # with a separate method of new()
            receiver_iface = Receiver()
            yield context_iface.context_align(context_gus, request['receivers'])
            yield receiver_iface.full_receiver_align(context_gus, request['receivers'])

            context_description = yield context_iface.get_single(context_gus)

            self.set_status(200)
            self.write(context_description)

        except InvalidInputFormat, e:

            self.set_status(e.http_status)
            self.write({'error_message': e.error_message, 'error_code' : e.error_code})
Exemplo n.º 2
0
    def update_context(self, context_gus, request):

        store = self.getStore()

        context_iface = Context(store)
        context_iface.update(context_gus, request)

        # 'receivers' it's a relationship between two tables, and is managed
        # with a separate method of update()
        receiver_iface = Receiver(store)
        context_iface.context_align(context_gus, request['receivers'])
        receiver_iface.full_receiver_align(context_gus, request['receivers'])

        context_description = context_iface.get_single(context_gus)

        self.returnData(context_description)
        self.returnCode(200)
        return self.prepareRetVals()