示例#1
0
    def _fetch_attachment_json(cls, attachment_id):
        if not Patch.is_valid_patch_id(attachment_id):
            _log.warn('Invalid attachment id: "{}", skipping download.'.format(
                attachment_id))
            return None

        attachment_url = '{}rest/bug/attachment/{}'.format(
            config.BUG_SERVER_URL, attachment_id)
        attachment = util.fetch_data_from_url(attachment_url)
        if not attachment:
            return None
        attachment_json = attachment.json().get('attachments')
        if not attachment_json or len(attachment_json) == 0:
            return None
        return attachment_json.get(str(attachment_id))
示例#2
0
 def filter_valid_patches(cls, patch_ids):
     return list(filter(lambda p: Patch.is_valid_patch_id(p), patch_ids))