Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace most rule classes with R objects #12

Closed
wants to merge 11 commits into from
Closed

Replace most rule classes with R objects #12

wants to merge 11 commits into from

Conversation

daisylb
Copy link
Owner

@daisylb daisylb commented May 31, 2019

Fixes #9.

You can read documentation for this branch here: http://storage.googleapis.com/bridgekeeper-docs/refs/heads/r-objects/index.html

@daisylb daisylb force-pushed the r-objects branch 3 times, most recently from aa0951b to 9a84de5 Compare August 20, 2019 12:21
@daisylb daisylb force-pushed the r-objects branch 5 times, most recently from 2ca60db to bc0ec1c Compare August 24, 2019 12:05
@daisylb
Copy link
Owner Author

daisylb commented Sep 5, 2019

Some to-do items courtesy of feedback from @rixx:

  • Add a way to match against the current time. Currently it's possible to do R(something=lambda _: timezone.now()), but that's not pretty.

  • Add support for lookups, like __lte. Currently R assumes that lookups aren't used. Ideally, it should detect which parts of a kwarg key would be interpreted by Django as lookups, and then if that lookup is supported, use a Python implementation of the lookup with the same semantics in .check(), and throw an error otherwise.

    Ideally, this error would be thrown when the R object is created, because it's better to fail early, but I'd need to look at how lookups work in Django; I'm concerned that whether something is following a FK or a lookup might be selectively determined based on metadata about the model, which isn't available to us at the time R's constructor is called. (For instance, does Django determine the meaning of foo__lte by checking either to see if foo is of a type that supports the __lte lookup, and/or checking if it's a FK to a model with a lte field?)

  • Add a page of examples to the docs, that goes into more detail than the tutorial, but is more useful for people that are example-oriented than the API reference.

  • Add at least one example where an R takes multiple kwargs.

I also want to do a bunch more work on the guides in the docs, but that's mostly separate to this ticket.

@daisylb daisylb closed this May 29, 2020
@daisylb
Copy link
Owner Author

daisylb commented Jun 28, 2020

I accidentally closed this while renaming the main branch :S

@daisylb
Copy link
Owner Author

daisylb commented Jun 28, 2020

This is now merged 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Simpler, more concise rule declarations with R objects
1 participant