コード例 #1
0
 def construct_query(self, msg):
     subs = construct_substitutions(msg)
     kwargs = format_args(copy.copy(self._d['filter']), subs)
     kwargs = recursive_lambda_factory(kwargs, msg, name='msg')
     kwargs['defer'] = True
     total, pages, query = datanommer.models.Message.grep(**kwargs)
     return total, pages, query
コード例 #2
0
ファイル: rules.py プロジェクト: jamielinux/fedbadges
    def matches(self, msg):
        """ A pkgdb criteria check checks if a user owns some packages. """

        subs = construct_substitutions(msg)
        expectation = format_args(copy.copy(self._d['owns']), subs)
        expectation = recursive_lambda_factory(expectation, msg, name='msg')

        actual_packages = get_pkgdb_packages_for(
            config=fedmsg_config,
            user=expectation['user'],
        )

        return set(expectation['packages']).issubset(actual_packages)
コード例 #3
0
ファイル: rules.py プロジェクト: snehalbaghel/fedbadges
    def matches(self, msg):
        """ A pkgdb criteria check checks if a user owns some packages. """

        subs = construct_substitutions(msg)
        expectation = format_args(copy.copy(self._d['owns']), subs)
        expectation = recursive_lambda_factory(expectation, msg, name='msg')

        actual_packages = get_pkgdb_packages_for(
            config=fedmsg_config,
            user=expectation['user'],
        )

        return set(expectation['packages']).issubset(actual_packages)
コード例 #4
0
ファイル: rules.py プロジェクト: jamielinux/fedbadges
    def _construct_query(self, msg):
        """ Construct a datanommer query for this message.

        The "filter" section of this criteria object will be used.  It will
        first be formatted with any substitutions present in the incoming
        message.  This is used, for instance, to construct a query like "give
        me all the messages bearing the same topic as the message that just
        arrived".
        """
        subs = construct_substitutions(msg)
        kwargs = format_args(copy.copy(self._d['filter']), subs)
        kwargs = recursive_lambda_factory(kwargs, msg, name='msg')
        kwargs['defer'] = True
        total, pages, query = datanommer.models.Message.grep(**kwargs)
        return total, pages, query
コード例 #5
0
ファイル: rules.py プロジェクト: snehalbaghel/fedbadges
    def _construct_query(self, msg):
        """ Construct a datanommer query for this message.

        The "filter" section of this criteria object will be used.  It will
        first be formatted with any substitutions present in the incoming
        message.  This is used, for instance, to construct a query like "give
        me all the messages bearing the same topic as the message that just
        arrived".
        """
        subs = construct_substitutions(msg)
        kwargs = format_args(copy.copy(self._d['filter']), subs)
        kwargs = recursive_lambda_factory(kwargs, msg, name='msg')
        kwargs['defer'] = True
        total, pages, query = datanommer.models.Message.grep(**kwargs)
        return total, pages, query