CapPaste: add method to find if a paste is suitable for the backend

Basic support in pastoob added (there is no way yet to change the
default options).
Backends support the "public/private" requirement.
This commit is contained in:
Laurent Bachelier 2011-04-27 00:41:50 +02:00
commit fbd4511ffa
6 changed files with 50 additions and 3 deletions

View file

@ -64,6 +64,22 @@ class ICapPaste(IBaseCap):
"""
raise NotImplementedError()
def can_post(self, public=None):
"""
Checks if the paste can be pasted by this backend.
Some properties are considered required (public/private, max_age) while others
are just bonuses (language).
public: True must be public, False must be private, None do not care
A score of 0 means the backend is not suitable.
A score of 1 means the backend is suitable.
Higher scores means it is more suitable than others with a lower score.
@return int Score
"""
raise NotImplementedError()
def get_paste(self, url):
"""
Get a Paste from an ID or URL.