Parcourir la source

Add a lastrevid property to pages.

tags/v0.2
Ben Kurtovic il y a 10 ans
Parent
révision
33107c6a01
1 fichiers modifiés avec 14 ajouts et 0 suppressions
  1. +14
    -0
      earwigbot/wiki/page.py

+ 14
- 0
earwigbot/wiki/page.py Voir le fichier

@@ -50,6 +50,7 @@ class Page(CopyvioMixIn):
- :py:attr:`pageid`: an integer ID representing the page
- :py:attr:`url`: the page's URL
- :py:attr:`namespace`: the page's namespace as an integer
- :py:attr:`lastrevid`: the ID of the page's most recent revision
- :py:attr:`protection`: the page's current protection status
- :py:attr:`is_talkpage`: ``True`` if this is a talkpage, else ``False``
- :py:attr:`is_redirect`: ``True`` if this is a redirect, else ``False``
@@ -464,6 +465,19 @@ class Page(CopyvioMixIn):
return self._namespace

@property
def lastrevid(self):
"""The ID of the page's most recent revision.

Raises :py:exc:`~earwigbot.exceptions.InvalidPageError` or
:py:exc:`~earwigbot.exceptions.PageNotFoundError` if the page name is
invalid or the page does not exist, respectively.
"""
if self._exists == self.PAGE_UNKNOWN:
self._load()
self._assert_existence() # Missing pages don't have revisions
return self._lastrevid

@property
def protection(self):
"""The page's current protection status.



Chargement…
Annuler
Enregistrer