Source code for aleph.datastructures.results

#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Interpreter version: python 2.7
#
#= Imports ====================================================================
"""
This module provides Result objects, that are sent back as answers to
requests.

All classes defined here are just simple namedtuple data containers, without
any other functionality.
"""

from collections import namedtuple


[docs]class ISBNValidationResult(namedtuple("ISBNValidationResult", ["is_valid"])): """ Response to ISBNValidationRequest. Attributes: is_valid (bool): True, if ISBN is valid. """ pass
[docs]class SearchResult(namedtuple("SearchResult", ['records'])): """ This is response structure, which is sent back when SearchRequest is received. Attributes: records (list): array of AlephRecord structures """ pass
[docs]class CountResult(namedtuple("CountResult", ['num_of_records'])): """ This is returned back to client when he send CountRequest. Attributes: num_of_records (int): number of records. """ pass
[docs]class ExportResult(namedtuple("ExportResult", ["ISBN"])): """ Sent back as response to ExportRequest. This class is blank at the moment, because there is no information, that can be sen't back. Attributes: ISBN (str): ISBN of accepted publication """ pass