-
Notifications
You must be signed in to change notification settings - Fork 887
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
configurable view deriver #2021
Conversation
…d into configurable-view-deriver
Remove unneed config command in test.
…d into configurable-view-deriver
…d into configurable-view-deriver
…ure/configurable-view-deriver
…gurable-view-deriver
This is required for future changes, where we need the list of predicate names.
We also use the previously defined names() method on PredicateList to fetch the list of predicates and pull out all predicate values into it's own dictionary. Then the rest of the values are the view options for the view derivations. At the moment we do not check if the options matches a valid view derivation. No seatbelts for view options.
This is an integration test in the sense that it adds both a view derivation and then adds a view. That view is then tested to verify that it correctly returns and that the derivations haven't broken anything.
This way we can use that in tests.
Specifically predicated_view and attr_wrapped_view exist for MultiView to function, without them the view machinery doesn't work. They aren't technically view derivations because they are just containers for some data that the view machinery requires.
I just took care of point 2.... "over" now means closer to ingress, which is the same terminology used by tweens. |
While I agree that the tween API has its limitations, I don't think nor want that to hold up merging this new API in its current form just because the two API's are dissimilar. I do think we should allow We should start another PR to discuss how to fix the tween issue. |
Docs and docstrings LGTM (subject to successful Travis-CI builds)! |
Opened a new ticket for the Tween configuration. I really don't want it holding up these changes because I am already using view derivations using this branch for a semi-production app :P |
Okay my last issue is some UX / book-keeping stuff. Tweens do a bit of work to ensure that over/under are strings and also provide Currently it's basically wrong to ever call The main thing that worries me is that if you specify Anyway I don't really have any action items about this but I want to bring it up as an easy way to shoot yourself in the foot. One option is to always specify over/under if they are I swear this is my last issue. |
I don't really have a problem leaving things as-is but here's what I'm talking about. If a deriver does not define both an over and an under then the deriver is underspecified and could be placed into unexpected spots in the view pipeline. For example if I say The feature I've been considering is simply a sanity check step after registering all derivers that would ensure that every deriver eventually maps back to one of the builtins in both |
I vote for making users fully specify their over/under and anything else raises an error. None of this wishy washy type stuff that leads to potential errors down the road. |
👍 I am very happy with this branch! |
I'm also happy with it. The only other thing I can think of changing atm is some checks to force preserving the order of the builtins but I don't think it's a big deal. |
Thank you @mmerickel for all your hard work on making this a succes :-) |
This is a work in progress PR, this branch we want to use to continue pushing changes until this feature is complete and ready to go.
Things left to do:
view, default, **kw
toview, value, **kw
. We want to pull the value out of thekwargs
automatically and set it as the value, if there is no value in thekwargs
we pass in the registered default.**predicates
to**view_options
, and split out**predicates
and**options
. Options is going to hold on to thekwargs
for the derivation views, and predicates is going to hold on to thekwargs
for the predicates, as the name implies.@wraps_view
when registering the view derivation usingadd_view_derivation
. We want to keep @wraps_view as private API until someone says they absolutely need it.outer_derivation = attr_wrapped, predicated_view
. These have to exist, without them the whole view machinery does not work. So we don't allow them to be replaced/changed/or anything.inner_derivation = -renderered_view
, we need to registerrendered_view
as a default, but we don't want to dictate that no-one could potentially insert a view derivation after it.view, value, **kw
rather thanview, default, **kw
The Future Possibly Holds:
config._add_predicate
register the discriminator twice, just in case someone used the discriminator for theview predicate
, currently it is renamed toview options
. While a b/w incompatible change one that @mmerickel and I agree doesn't really hurt. We will only do this if absolutely necessary.add_view_derivation
, so that you can define whichkwarg
you want, rather than basing it strictly on your view derivations name.