Skip to content
This repository has been archived by the owner on Jul 24, 2018. It is now read-only.

Allow individual rules to be negated. #12

Merged
merged 4 commits into from
Aug 24, 2014
Merged

Conversation

ralphbean
Copy link
Contributor

This allows you to have a filter that's like:
'send me all messages that have my username associated with them except for meetbot messages'

ralphbean added a commit to fedora-infra/fmn.web that referenced this pull request Aug 22, 2014
}
if reify:
result['fn'] = fedmsg.utils.load_class(str(self.code_path))
return result

def __repr__(self):
return "<fmn.lib.models.Rule: %r(**%r)>" % (
self.code_path, self.arguments)
negation = '' or self.negated and '!'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

>>> '' or False and '!'
False
>>> '' or True and '!'
'!'

is it the idea?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! I got it backwards :(

It should be like this:

>>> True and '!' or ''
'!'
>>> False and '!' or ''
''

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be fixed in 5f84885

@pypingou
Copy link
Member

One question on repr, otherwise, 👍

@pypingou
Copy link
Member

👍 for me

@ralphbean
Copy link
Contributor Author

Thanks Pierre!

ralphbean added a commit that referenced this pull request Aug 24, 2014
Allow individual rules to be negated.
@ralphbean ralphbean merged commit d6eeac2 into develop Aug 24, 2014
@ralphbean ralphbean deleted the feature/rule-negation branch August 24, 2014 14:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants