Ejemplo n.º 1
0
    def post(self):
        """
        Get the specified receiver.

        Request: adminReceiverDesc
        Response: adminReceiverDesc
        Errors: InvalidInputFormat, ContextIdNotFound
        """
        request = self.validate_message(self.request.body,
                                        requests.adminReceiverDesc)

        response = yield create_receiver(request, self.request.language)

        # get the updated list of receivers, and update the cache
        public_receivers_list = yield get_public_receiver_list(self.request.language)
        GLApiCache.invalidate('receivers')
        GLApiCache.set('receivers', self.request.language, public_receivers_list)

        # receivers update causes also contexts update and
        # node update due to 'configured' based on context-receiver association
        GLApiCache.invalidate('contexts')
        GLApiCache.invalidate('node')

        self.set_status(201) # Created
        self.finish(response)
Ejemplo n.º 2
0
    def test_tip_creation(self):

        receivers = yield get_public_receiver_list('en')
        contexts = yield get_public_context_list('en')

        yield create_submission(self.dummySubmission, finalize=True)
        created_tips = yield delivery_sched.tip_creation()
        self.assertEqual(len(created_tips), 2) # this createSubmission and the helpers one

        receiver_tips = yield get_receiver_tip_list(self.dummyReceiver['receiver_gus'])

        expected_keys = ['access_counter', 'creation_date', 'expressed_pertinence', 'id', 'files_number', 'last_access', 'preview']
        self.assertEqual(set(receiver_tips[0].keys()), set(expected_keys))
Ejemplo n.º 3
0
    def put(self):
        """
        Parameters: None
        Request: ReceiverReceiverDesc
        Response: ReceiverReceiverDesc
        Errors: ReceiverIdNotFound, InvalidInputFormat, InvalidAuthentication, TipIdNotFound
        """
        request = self.validate_message(self.request.body, requests.ReceiverReceiverDesc)

        receiver_status = yield update_receiver_settings(self.current_user.user_id, request, self.request.language)

        # get the updated list of receivers, and update the cache
        public_receivers_list = yield get_public_receiver_list(self.request.language)
        GLApiCache.invalidate("receivers")
        GLApiCache.set("receivers", self.request.language, public_receivers_list)

        self.set_status(200)
        self.finish(receiver_status)
Ejemplo n.º 4
0
    def delete(self, receiver_id, *uriargs):
        """
        Parameter: receiver_id
        Request: None
        Response: None
        Errors: InvalidInputFormat, ReceiverIdNotFound
        """
        yield delete_receiver(receiver_id)

        # get the updated list of receivers, and update the cache
        public_receivers_list = yield get_public_receiver_list(self.request.language)
        GLApiCache.invalidate('receivers')
        GLApiCache.set('receivers', self.request.language, public_receivers_list)

        # receivers update causes also contexts update
        GLApiCache.invalidate('contexts')

        self.set_status(200) # OK and return not content
        self.finish()
Ejemplo n.º 5
0
    def delete(self, receiver_id):
        """
        Delete the specified receiver.

        Parameters: receiver_id
        Request: None
        Response: None
        Errors: InvalidInputFormat, ReceiverIdNotFound
        """
        yield delete_receiver(receiver_id)

        # get the updated list of receivers, and update the cache
        public_receivers_list = yield get_public_receiver_list(self.request.language)
        GLApiCache.invalidate('receivers')
        GLApiCache.set('receivers', self.request.language, public_receivers_list)

        # receivers update causes also contexts update
        GLApiCache.invalidate('contexts')

        self.set_status(200) # OK and return not content
        self.finish()
Ejemplo n.º 6
0
    def put(self, receiver_id, *uriargs):
        """
        Request: adminReceiverDesc
        Response: adminReceiverDesc
        Errors: InvalidInputFormat, ReceiverIdNotFound, ContextId

        Update information about a Receiver, return the instance updated.
        """
        request = self.validate_message(self.request.body, requests.adminReceiverDesc)

        response = yield update_receiver(receiver_id, request, self.request.language)

        # get the updated list of receivers, and update the cache
        public_receivers_list = yield get_public_receiver_list(self.request.language)
        GLApiCache.invalidate('receivers')
        GLApiCache.set('receivers', self.request.language, public_receivers_list)

        # receivers update causes also contexts update
        GLApiCache.invalidate('contexts')

        self.set_status(201)
        self.finish(response)
Ejemplo n.º 7
0
    def put(self):
        """
        Parameters: None
        Request: ReceiverReceiverDesc
        Response: ReceiverReceiverDesc
        Errors: ReceiverIdNotFound, InvalidInputFormat, InvalidAuthentication, TipIdNotFound
        """
        request = self.validate_message(self.request.body,
                                        requests.ReceiverReceiverDesc)

        receiver_status = yield update_receiver_settings(
            self.current_user.user_id, request, self.request.language)

        # get the updated list of receivers, and update the cache
        public_receivers_list = yield get_public_receiver_list(
            self.request.language)
        GLApiCache.invalidate('receivers')
        GLApiCache.set('receivers', self.request.language,
                       public_receivers_list)

        self.set_status(200)
        self.finish(receiver_status)
Ejemplo n.º 8
0
    def post(self):
        """
        """

        request = self.validate_message(self.request.body,
                                        requests.WizardFirstSetupDesc)

        yield wizard(request, self.request.language)

        # cache must be updated in particular to set wizard_done = True
        public_node_desc = yield anon_serialize_node(self.request.language)
        GLApiCache.invalidate('node')
        GLApiCache.invalidate('contexts')
        GLApiCache.invalidate('receivers')
        GLApiCache.set('node', self.request.language, public_node_desc)
        public_contexts_list = yield get_public_context_list(self.request.language)
        GLApiCache.set('contexts', self.request.language, public_contexts_list)
        public_receivers_list = yield get_public_receiver_list(self.request.language)
        GLApiCache.set('receivers', self.request.language, public_receivers_list)

        self.set_status(201)  # Created
        self.finish()
Ejemplo n.º 9
0
    def post(self, *uriargs):
        """
        Request: adminReceiverDesc
        Response: adminReceiverDesc
        Errors: InvalidInputFormat, ContextIdNotFound

        Create a new receiver
        """
        request = self.validate_message(self.request.body,
                requests.adminReceiverDesc)

        response = yield create_receiver(request, self.request.language)

        # get the updated list of receivers, and update the cache
        public_receivers_list = yield get_public_receiver_list(self.request.language)
        GLApiCache.invalidate('receivers')
        GLApiCache.set('receivers', self.request.language, public_receivers_list)

        # receivers update causes also contexts update
        GLApiCache.invalidate('contexts')

        self.set_status(201) # Created
        self.finish(response)