Пример #1
0
        return dict([(k, UtilityConduitMixin._to_serialize_list(v),) for k, v in value.items()])


    @staticmethod
    def _to_serialize_search_value(value):
        """
        Convert the value to the external (JSON-based) representation.
        """
        def _convert(item):
            return map(lambda x: x.isoformat(" ") if isinstance(x, datetime) else x, item)
        return map(_convert, value)

# These are the actions on store objects we need to expose via the conduit api

# Calls on L{CommonHome} objects
UtilityConduitMixin._make_simple_action(StoreAPIConduitMixin, "home_metadata", "serialize")
UtilityConduitMixin._make_simple_action(StoreAPIConduitMixin, "home_set_status", "setStatus")
UtilityConduitMixin._make_simple_action(StoreAPIConduitMixin, "home_get_all_group_attendees", "getAllGroupAttendees", transform_recv_result=StoreAPIConduitMixin._to_serialize_pair_list)
UtilityConduitMixin._make_simple_action(StoreAPIConduitMixin, "home_shared_to_records", "sharedToBindRecords", transform_recv_result=StoreAPIConduitMixin._to_serialize_dict_list_serialized_value)
UtilityConduitMixin._make_simple_action(StoreAPIConduitMixin, "home_imip_tokens", "iMIPTokens", transform_recv_result=UtilityConduitMixin._to_serialize_list)
UtilityConduitMixin._make_simple_action(StoreAPIConduitMixin, "home_pause_work", "pauseWork")
UtilityConduitMixin._make_simple_action(StoreAPIConduitMixin, "home_unpause_work", "unpauseWork")
UtilityConduitMixin._make_simple_action(StoreAPIConduitMixin, "home_work_items", "workItems")

# Calls on L{CommonHomeChild} objects
UtilityConduitMixin._make_simple_action(StoreAPIConduitMixin, "homechild_listobjects", "listObjects", classMethod=True)
UtilityConduitMixin._make_simple_action(StoreAPIConduitMixin, "homechild_loadallobjects", "loadAllObjects", classMethod=True, transform_recv_result=UtilityConduitMixin._to_serialize_list)
UtilityConduitMixin._make_simple_action(StoreAPIConduitMixin, "homechild_objectwith", "objectWith", classMethod=True, transform_recv_result=UtilityConduitMixin._to_serialize)
UtilityConduitMixin._make_simple_action(StoreAPIConduitMixin, "homechild_movehere", "moveObjectResourceHere")
UtilityConduitMixin._make_simple_action(StoreAPIConduitMixin, "homechild_moveaway", "moveObjectResourceAway")
UtilityConduitMixin._make_simple_action(StoreAPIConduitMixin, "homechild_synctokenrevision", "syncTokenRevision")
Пример #2
0
        @param request: request arguments
        @type request: C{dict}
        """

        home, _ignore = yield self._getStoreObjectForRequest(txn, request)
        attachment = yield home.getAttachmentByID(request["attachmentID"])
        if attachment is None:
            raise InvalidAttachmentOperation(
                "Attachment is missing: {}".format(request["attachmentID"]))

        attachment.retrieve(stream)
        returnValue((
            generateContentType(attachment.contentType()),
            attachment.name(),
        ))


# Calls on L{CommonHome} objects
UtilityConduitMixin._make_simple_action(
    AttachmentsConduitMixin,
    "home_get_all_attachments",
    "getAllAttachments",
    classMethod=False,
    transform_recv_result=UtilityConduitMixin._to_serialize_list)
UtilityConduitMixin._make_simple_action(
    AttachmentsConduitMixin,
    "home_get_attachment_links",
    "getAttachmentLinks",
    classMethod=False,
    transform_recv_result=UtilityConduitMixin._to_serialize_list)
Пример #3
0
    def _to_serialize_search_value(value):
        """
        Convert the value to the external (JSON-based) representation.
        """
        def _convert(item):
            return map(
                lambda x: x.isoformat(" ")
                if isinstance(x, datetime) else x, item)

        return map(_convert, value)


# These are the actions on store objects we need to expose via the conduit api

# Calls on L{CommonHome} objects
UtilityConduitMixin._make_simple_action(StoreAPIConduitMixin, "home_metadata",
                                        "serialize")
UtilityConduitMixin._make_simple_action(StoreAPIConduitMixin,
                                        "home_set_status", "setStatus")
UtilityConduitMixin._make_simple_action(
    StoreAPIConduitMixin,
    "home_get_all_group_attendees",
    "getAllGroupAttendees",
    transform_recv_result=StoreAPIConduitMixin._to_serialize_pair_list)
UtilityConduitMixin._make_simple_action(
    StoreAPIConduitMixin,
    "home_shared_to_records",
    "sharedToBindRecords",
    transform_recv_result=StoreAPIConduitMixin.
    _to_serialize_dict_list_serialized_value)
UtilityConduitMixin._make_simple_action(
    StoreAPIConduitMixin,
Пример #4
0
        actionName = "get-attachment-data"
        txn, request, server = yield self._getRequestForStoreObject(actionName, home, False)
        request["attachmentID"] = attachment_id

        response = yield self.sendRequestToServer(txn, server, request, writeStream=stream)
        returnValue(response)


    @inlineCallbacks
    def recv_get_attachment_data(self, txn, request, stream):
        """
        Process an getAttachmentData cross-pod request. Request arguments as per L{send_get_attachment_data}.

        @param request: request arguments
        @type request: C{dict}
        """

        home, _ignore = yield self._getStoreObjectForRequest(txn, request)
        attachment = yield home.getAttachmentByID(request["attachmentID"])
        if attachment is None:
            raise InvalidAttachmentOperation("Attachment is missing: {}".format(request["attachmentID"]))

        attachment.retrieve(stream)
        returnValue((generateContentType(attachment.contentType()), attachment.name(),))


# Calls on L{CommonHome} objects
UtilityConduitMixin._make_simple_action(AttachmentsConduitMixin, "home_get_all_attachments", "getAllAttachments", classMethod=False, transform_recv_result=UtilityConduitMixin._to_serialize_list)
UtilityConduitMixin._make_simple_action(AttachmentsConduitMixin, "home_get_attachment_links", "getAttachmentLinks", classMethod=False, transform_recv_result=UtilityConduitMixin._to_serialize_list)