a little complicated AccessRules
after hearing that AccessRules is what I should seek if I need PATH_INFO information, I have struggled with AccessRules all evening. what I am looking to do is the following: http://server.com/people/krafft http://server.com/people/krafft/ should both invoke a ZPT at http://server.com/people/dispatch, making the information '/krafft' available to the ZPT. however, and here comes the trick, http://server.com/people/krafft/anything should serve ./anything out of /people/krafft. is this possible? how? thanks! -- martin; (greetings from the heart of the sun.) \____ echo mailto: !#^."<*>"|tr "<*> mailto:" net@madduck keyserver problems? http://keyserver.kjsl.com/~jharris/keyserver.html get my key here: http://madduck.net/me/gpg/publickey "i wish there was a knob on the tv to turn up the intelligence. there's a knob called 'brightness', but it doesn't seem to work." -- gallagher
martin f krafft wrote:
http://server.com/people/krafft http://server.com/people/krafft/
should both invoke a ZPT at http://server.com/people/dispatch, making the information '/krafft' available to the ZPT.
http://server.com/people/krafft/anything
should serve ./anything out of /people/krafft.
I'm not sure if I'm interpreting you correctly, but you seem to want: http://server.com/people/<something> ...to pass the string "<something>" as a parameter to a ZPT, while: http://server.com/people/<something>/<somethingelse> ...is served normally? If you do it exactly this way, it is going to cause you pain the moment you try to manage /people, since your '/people/manage_main' will get handed off to dispatch. I recommend adding a way to distinguish these special requests, such as a prefix for the path element. In that case, you want a Script inside /people set as the Access Rule for that Folder: req = container.REQUEST trstack = req['TraversalRequestNameStack'] if len(trstack) == 1 and trstack[0][0] == '*': # There's only one path element left to traverse, # and it starts with a '*' prefix req.set('dispatch_arg', trstack.pop()[1:]) trstack.append('dispatch') Then, in your ZPT, use "request/dispatch_arg" to access the parameter. Cheers, Evan @ 4-am
also sprach Evan Simpson <evan@4-am.com> [2003.05.02.1725 +0200]:
I'm not sure if I'm interpreting you correctly, but you seem to want:
http://server.com/people/<something>
...to pass the string "<something>" as a parameter to a ZPT, while:
http://server.com/people/<something>/<somethingelse>
...is served normally?
Yes, exactly.
If you do it exactly this way, it is going to cause you pain the moment you try to manage /people, since your '/people/manage_main' will get handed off to dispatch.
And that's a good point. Here's something that came to my mind: I create a new portal_type, the PersonFolder. It behaves like a regular (Plone) folder, but when accessed directly, it does my thing rather than display index_html or use its own handler to generate e.g. a folder listing. Would this be possible? It seems like it does, because I can redefine the view action of a Plone folder to something like 'dispatch', and then that folder calls dispatch rather than index_html. I am trying it, it looks promising. Maybe you guys have a better idea... -- martin; (greetings from the heart of the sun.) \____ echo mailto: !#^."<*>"|tr "<*> mailto:" net@madduck keyserver problems? http://keyserver.kjsl.com/~jharris/keyserver.html get my key here: http://madduck.net/me/gpg/publickey i am willing to make the mistakes if someone else is willing to learn from them.
also sprach martin f krafft <madduck@madduck.net> [2003.05.03.2035 +0200]:
I create a new portal_type, the PersonFolder. It behaves like a regular (Plone) folder, but when accessed directly, it does my thing rather than display index_html or use its own handler to generate e.g. a folder listing.
I tried this in Plone by copying the portal_type for folder and amending it, but that broke the regular folder type. As soon as I had the PersonFolder working right (and yes, it worked just like I wanted), the folder_contents of other folders broke with the error: TypesError 'in ' required character as left operand. since I failed to fix that other than by deleting the PersonFolder, it looks like I have to take another route. Or do you guys know what's wrong? How easy is it to define a new type, extending Plone's Folder type? -- martin; (greetings from the heart of the sun.) \____ echo mailto: !#^."<*>"|tr "<*> mailto:" net@madduck keyserver problems? http://keyserver.kjsl.com/~jharris/keyserver.html get my key here: http://madduck.net/me/gpg/publickey as i learn the innermost secrets of the people around me, they reward me in many ways to keep me quiet.
participants (2)
-
Evan Simpson -
martin f krafft