-
Notifications
You must be signed in to change notification settings - Fork 889
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
figure out how to normalize view introspectables #2533
Comments
Well after digging a bit deeper I discovered that the introspectable did not actually show the final value, which means I was able to refactor the logic to work exactly like csrf does. #2534 demonstrates this. The second part of this issue is still valid which is that it'd be nice if view derivers could affect the introspectable. If they could, we would be able to move a fairly large chunk of logic out of pyramid/pyramid/config/views.py Lines 1056 to 1091 in 52bfe0a
|
I might need to abandon my hopes of having view derivers register their own introspectables. The initial thought was to add
No show stoppers, but it doesn't exactly feel like it's falling into place either. |
The
permission=
andconfig.set_default_permission
are normalized inconfig.add_view
where the default permission is actually pulled out and set as the value ininfo.options
. This is inconsistent with therequire_csrf=
andconfig.set_default_csrf_options
where if the default is used thenrequire_csrf
does not show up in the introspectable (not good). Unfortunately if we normalize the value inadd_view
then:require_csrf
was set on the view or not. This is necessary to determine whether to enforce the checks on the exception view, which are only used if the user explicitly sets the value.I'm currently thinking it may be necessary to define
info.raw_options
versusinfo.options
or something, to tell exactly what options were passed to theconfig.add_view
versus which ones were normalized. However, again, this normalization is something only Pyramid can do (insideconfig.add_view
), which is not ideal when thinking about extension authors.We could also stop normalizing permission. However, I'd still want the introspectable to show the final value. How to do this? We could put the introspectable in the view deriver info, and allow the derivers to write to it. So far that's the best option I have.
The text was updated successfully, but these errors were encountered: