コード例 #1
0
ファイル: bugs.py プロジェクト: rpmfusion-infra/packagedb
    def __convert(self, bug):
        '''Convert bugs from the raw form retrieved from python-bugzilla to
        one that is consumable by a normal python program.

        This involves converting byte strings to unicode type and substituting
        any private URLs returned into a public URL.  (This occurs when we
        have to call bugzilla via one name on the internal network but someone
        clicking on the link in a web page needs to use a different address.)

        :arg bug: A bug record returned from the python-bugzilla interface.
        '''
        if not isinstance(bug, Bug):
            raise TypeError(_('Can only store bugzilla.Bug type'))
        if self.query_url != self.public_url:
            bug.url = bug.url.replace(self.query_url, self.public_url)

        bug.bug_status = to_unicode(bug.bug_status)
        bug.short_desc = to_unicode(bug.short_desc)
        bug.product = to_unicode(bug.product)
        return {
            'url': bug.url,
            'bug_status': bug.bug_status,
            'short_desc': bug.short_desc,
            'bug_id': bug.bug_id,
            'product': bug.product
        }
コード例 #2
0
ファイル: bugs.py プロジェクト: fedora-infra/packagedb
    def __convert(self, bug):
        """Convert bugs from the raw form retrieved from python-bugzilla to
        one that is consumable by a normal python program.

        This involves converting byte strings to unicode type and substituting
        any private URLs returned into a public URL.  (This occurs when we
        have to call bugzilla via one name on the internal network but someone
        clicking on the link in a web page needs to use a different address.)

        :arg bug: A bug record returned from the python-bugzilla interface.
        """
        if not isinstance(bug, Bug):
            raise TypeError(_("Can only store bugzilla.Bug type"))
        if self.query_url != self.public_url:
            bug.url = bug.url.replace(self.query_url, self.public_url)

        bug.bug_status = to_unicode(bug.bug_status)
        bug.short_desc = to_unicode(bug.short_desc)
        bug.product = to_unicode(bug.product)
        return {
            "url": bug.url,
            "bug_status": bug.bug_status,
            "short_desc": bug.short_desc,
            "bug_id": bug.bug_id,
            "product": bug.product,
        }
コード例 #3
0
ファイル: validators.py プロジェクト: Tubbz-alt/packagedb
 def _to_python(self, value, state):
     value = Regex._to_python(self, value, state)
     return to_unicode(value)