~launchpad-pqm/launchpad/devel

14277.1.2 by Robert Collins
Move things around and declare the desired interface.
1
# Copyright 2011 Canonical Ltd.  This software is licensed under the
2
# GNU Affero General Public License version 3 (see the file LICENSE).
3
4
"""Interfaces for querying OOPS references."""
5
6
__metaclass__ = type
7
8
__all__ = [
9
    'IHasOOPSReferences',
10
    ]
11
12
13
from lazr.restful.declarations import (
14
    export_read_operation,
15
    operation_for_version,
16
    operation_parameters,
17
    )
14550.1.1 by Steve Kowalik
Run format-imports over lib/lp and lib/canonical/launchpad
18
from zope.interface import Interface
19
from zope.schema import Datetime
14277.1.2 by Robert Collins
Move things around and declare the desired interface.
20
14600.1.12 by Curtis Hovey
Move i18n to lp.
21
from lp import _
14277.1.2 by Robert Collins
Move things around and declare the desired interface.
22
23
24
class IHasOOPSReferences(Interface):
25
    """Has references to OOPSes that can be queried."""
26
27
    @operation_parameters(
28
        start_date=Datetime(title=_("Modified after date")),
14277.1.4 by Robert Collins
API connected up and tested.
29
        end_date=Datetime(title=_("Modified before date")),
14277.1.2 by Robert Collins
Move things around and declare the desired interface.
30
        )
31
    @export_read_operation()
32
    @operation_for_version('devel')
33
    def findReferencedOOPS(start_date, end_date):
34
        """Find OOPS reports between start_date and end_date.
35
36
        :param start_date: Do not look in objects whose last modification time
37
            is before this date.
38
        :param end_date: Do not look in objects whose last modification time
39
            is after this date.
40
        :return: A set of OOPS id's - strings of the form 'OOPS-\w+'.
41
        """