@@ -42,7 +42,7 @@ def check_rev(session, rev, **kwargs):
4242
4343
4444def check (session , rev_id , page_id = None , radius = defaults .RADIUS ,
45- before = None , properties = None ):
45+ before = None , window = None , properties = None ):
4646 """
4747 Checks whether a revision was reverted (identity) and returns a named tuple
4848 of Revert(reverting, reverteds, reverted_to).
@@ -55,9 +55,14 @@ def check(session, rev_id, page_id=None, radius=defaults.RADIUS,
5555 page_id : int
5656 the ID of the page the revision occupies (slower if not provided)
5757 radius : int
58- a positive integer indicating the maximum number of revisions that can be reverted
58+ a positive integer indicating the maximum number of revisions
59+ that can be reverted
5960 before : :class:`mw.Timestamp`
60- if set, limits the search for *reverting* revisions to those which were saved before this timestamp
61+ if set, limits the search for *reverting* revisions to those which
62+ were saved before this timestamp
63+ window : int
64+ if set, limits the search for *reverting* revisions to those which
65+ were saved within `window` seconds after the reverted edit
6166 properties : set( str )
6267 a set of properties to include in revisions (see :class:`mw.api.Revisions`)
6368 """
@@ -99,6 +104,9 @@ def check(session, rev_id, page_id=None, radius=defaults.RADIUS,
99104 # reverted. Just return None.
100105 return None
101106
107+ if window is not None and before is None :
108+ before = Timestamp (current_rev ['timestamp' ]) + window
109+
102110 # Load future revisions
103111 future_revs = session .revisions .query (
104112 pageids = {page_id },
0 commit comments