简体   繁体   English

在 Plone 视图中获取路径作为参数

[英]Get path as paramether on Plone view

Here is my problem.这是我的问题。

I'm building a view at plone 5.2, that will serve as a callback service for a outside authentication service.我正在 plone 5.2 上构建一个视图,它将作为外部身份验证服务的回调服务。 The problem is that the autentication service does NOT callbacks to urls with query params, so, i gotta recieve a ID that I usually recieve as query param, as part of the atual url问题是身份验证服务不会使用查询参数回调 url,因此,我必须收到一个我通常作为查询参数收到的 ID,作为 atual url 的一部分

Ex.:前任。:

Fom this: domain/project/view?id=123来自: domain/project/view?id=123

to this: domain/project/view/123对此: domain/project/view/123

I know i can get the query params with request.form dictionary, but how can i make it so, when i call../view/1234 it actually understands that I'm calling view with id 1234?我知道我可以使用request.form字典获取查询参数,但是我怎样才能做到这一点,当我调用../view/1234 时,它实际上知道我正在调用id为 1234 的view

Tried using request.path, but the site understands i'm trying to access a page '1234' inside folder 'view'.尝试使用 request.path,但该站点知道我正在尝试访问文件夹“view”内的页面“1234”。

@edit: https://training.plone.org/5/advanced-python/routing.html @edit: https://training.plone.org/5/advanced-python/routing.html

I found this, but still, there is no property 'myapp.url_args', nor my page actually runs the __call__ method when calling it with /123 in the end我找到了这个,但是仍然没有属性'myapp.url_args',我的页面在最后用/123调用它时也没有实际运行__call__方法

What you want is to implement a method called publishTraverse.您想要的是实现一个名为 publishTraverse 的方法。 I think this page should fit your needs perfectly: https://bluedynamics.com/blog/jens/plone-traverse_subpath-for-browserviews-view-some-more-path我认为这个页面应该完全符合您的需求: https://bluedynamics.com/blog/jens/plone-traverse_subpath-for-browserviews-view-some-more-path

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM