pythonpython-requestsploneplone-5.x

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. 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

Ex.:

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

to this: 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 ?

Tried using request.path, but the site understands i'm trying to access a page '1234' inside folder 'view'.

@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


Solution

  • What you want is to implement a method called publishTraverse. I think this page should fit your needs perfectly: https://bluedynamics.com/blog/jens/plone-traverse_subpath-for-browserviews-view-some-more-path