コード例 #1
0
ファイル: backend.py プロジェクト: Boussadia/weboob
 def can_post(self, contents, title=None, public=None, max_age=None):
     if re.search(r'[^a-zA-Z0-9=+/\s]', contents):
         return 0
     elif max_age and max_age < 86400:
         return 0 # it cannot be shorter than one day
     else:
         mime = image_mime(contents, ('gif', 'jpeg', 'png'))
         return 20 * int(mime is not None)
コード例 #2
0
ファイル: module.py プロジェクト: nledez/cozy-weboob
 def can_post(self, contents, title=None, public=None, max_age=None):
     if re.search(r'[^a-zA-Z0-9=+/\s]', contents):
         return 0
     elif max_age is not None and not self.get_closest_expiration(max_age):
         return 0
     else:
         mime = image_mime(contents, ('gif', 'jpeg', 'png'))
         return 20 * int(mime is not None)
コード例 #3
0
 def can_post(self, contents, title=None, public=None, max_age=None):
     if re.search(r'[^a-zA-Z0-9=+/\s]', contents):
         return 0
     elif max_age and max_age < 86400:
         return 0  # it cannot be shorter than one day
     else:
         mime = image_mime(contents, ('gif', 'jpeg', 'png'))
         return 20 * int(mime is not None)
コード例 #4
0
ファイル: module.py プロジェクト: dasimon/weboob
 def can_post(self, contents, title=None, public=None, max_age=None):
     if re.search(r'[^a-zA-Z0-9=+/\s]', contents):
         return 0
     elif max_age is not None and not self.get_closest_expiration(max_age):
         return 0
     else:
         mime = image_mime(contents, ('gif', 'jpeg', 'png'))
         return 20 * int(mime is not None)
コード例 #5
0
ファイル: module.py プロジェクト: dasimon/weboob
 def can_post(self, contents, title=None, public=None, max_age=None):
     if re.search(r'[^a-zA-Z0-9=+/\s]', contents):
         return 0
     elif max_age:
         return 0 # expiration is not possible
     else:
         mime = image_mime(contents, ('gif', 'jpeg', 'png'))
         return 20 * int(mime is not None)
コード例 #6
0
ファイル: backend.py プロジェクト: pombredanne/weboob
 def can_post(self, contents, title=None, public=None, max_age=None):
     if re.search(r"[^a-zA-Z0-9=+/\s]", contents):
         return 0
     elif max_age:
         return 0  # expiration is not possible
     else:
         mime = image_mime(contents, ("gif", "jpeg", "png"))
         return 20 * int(mime is not None)
コード例 #7
0
ファイル: module.py プロジェクト: sourcery-ai-bot/weboob
 def can_post(self, contents, title=None, public=None, max_age=None):
     if re.search(r'[^a-zA-Z0-9=+/\s]', contents):
         return 0
     elif max_age:
         return 0 # expiration is not possible
     else:
         mime = image_mime(contents, ('gif', 'jpeg', 'png'))
         return 20 * int(mime is not None)
コード例 #8
0
ファイル: module.py プロジェクト: sourcery-ai-bot/weboob
 def can_post(self, contents, title=None, public=None, max_age=None):
     if (public is False or re.search(r'[^a-zA-Z0-9=+/\s]', contents)
             or not re.search(r'[^a-zA-Z0-9=+/\s]', contents) and max_age):
         return 0
     else:
         mime = image_mime(contents,
                           ('gif', 'jpeg', 'png', 'tiff', 'xcf', 'pdf'))
         return 20 * int(mime is not None)
コード例 #9
0
ファイル: module.py プロジェクト: laurentb/weboob
 def can_post(self, contents, title=None, public=None, max_age=None):
     if public is False:
         return 0
     elif re.search(r'[^a-zA-Z0-9=+/\s]', contents):
         return 0
     elif max_age:
         return 0
     else:
         mime = image_mime(contents, ('gif', 'jpeg', 'png', 'tiff', 'xcf', 'pdf'))
         return 20 * int(mime is not None)
コード例 #10
0
ファイル: browser.py プロジェクト: Boussadia/weboob
    def post_image(self, filename, contents, private=False, description=''):
        self.location('/')
        assert self.is_on_page(PageHome)

        mime = image_mime(contents.encode('base64'))
        self.select_form(nr=0)
        self.form.find_control('private').items[0].selected = private
        self.form['description'] = description or ''
        self.form.find_control('img').add_file(StringIO(contents), filename=filename, content_type=mime)
        self.submit()

        assert self.is_on_page(PageImage)
        return self.page.get_info()
コード例 #11
0
    def post_image(self, filename, contents, private=False, description=''):
        self.location('/')
        assert self.home.is_here()

        mime = image_mime(b64encode(contents))
        form = self.page.get_form(nr=0)
        form['private'] = int(private)
        form['description'] = description or ''
        del form['img']
        f = (filename, BytesIO(contents), mime)
        self.location(form.url, data=form, files={'img': f})

        assert self.img.is_here()
        return self.page.get_info()
コード例 #12
0
ファイル: browser.py プロジェクト: P4ncake/weboob
    def post_image(self, filename, contents, private=False, description=''):
        self.location('/')
        assert self.home.is_here()

        mime = image_mime(b64encode(contents))
        form = self.page.get_form(nr=0)
        form['private'] = int(private)
        form['description'] = description or ''
        del form['img']
        f = (filename, BytesIO(contents), mime)
        self.location(form.url, data=form, files={'img': f})

        assert self.img.is_here()
        return self.page.get_info()
コード例 #13
0
    def post_image(self, filename, contents, private=False, description=''):
        self.location('/')
        assert self.is_on_page(PageHome)

        mime = image_mime(contents.encode('base64'))
        self.select_form(nr=0)
        self.form.find_control('private').items[0].selected = private
        self.form['description'] = description or ''
        self.form.find_control('img').add_file(BytesIO(contents),
                                               filename=filename,
                                               content_type=mime)
        self.submit()

        assert self.is_on_page(PageImage)
        return self.page.get_info()