CapPaste: check the contents in can_post
For pastealacon, it is used to check for encoding compatibility.
This commit is contained in:
parent
56fe4448d3
commit
0d2148bd84
6 changed files with 32 additions and 22 deletions
|
|
@ -49,7 +49,11 @@ class PastealaconBackend(BaseBackend, BasePasteBackend):
|
|||
def new_paste(self, *args, **kwargs):
|
||||
return PastealaconPaste(*args, **kwargs)
|
||||
|
||||
def can_post(self, public=None, max_age=None):
|
||||
def can_post(self, contents, public=None, max_age=None):
|
||||
try:
|
||||
contents.encode(self.browser.ENCODING)
|
||||
except UnicodeEncodeError:
|
||||
return 0
|
||||
if public is False:
|
||||
return 0
|
||||
if max_age is not None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue