Hi, As a Zope newbie I'm still not entirely sure about how to capture the URL as Zope traverses the tree. For instance, my site called with : mysite.com/members/ian/preferences/10 "members" is a DTMLMethod or Document. What I want to do is trap the URL once it has entered "members". So inside "members" I want to do things like : 1. Get the next part of the url ("ian") and run an SQLMethod using this as a parameter (calling SQLMethods I understand). 2. Get the part after that, "preferences" and pull in my "preferences" DTML page from /templates/preferences, possibly passing it the next part of the url "10" as a parameter to that DTML page. The conceptual problem I have is that DTMLMethods/Documents don't have a parameters tag like SQLMethods do, so I don't see how I can "trap" parts of the URL like SQLMethods do and use them internally in my Method/Document. I know I keep asking this type of question, please bear with me 'till I get it! - Ian Sparks.
----- Original Message ----- From: Ian Sparks <isparks@wmute.u-net.com>
The conceptual problem I have is that DTMLMethods/Documents don't have a parameters tag like SQLMethods do, so I don't see how I can "trap" parts of the URL like SQLMethods do and use them internally in my Method/Document.
There isn't an automatic way to do this; SQLMethods are specially written to be traversable. There are three (fairly complex) ways to do this that I can think of: 1. Subclass DTMLDocument and mix in the class SQLMethods use for traversability. Probably hard. 2. Use a PythonMethod, and make one of its parameters 'traverse_subpath'. Then you can traverse through this PythonMethod and use the parameter to do what you want. Not bad, but you need to know PythonMethods. 3. Use a SiteAccess Access Rule on the folder, having it check to see if the next object to be traversed is your DTMLMethod. If so (and if the next name doesn't start with 'manage'!) remove the rest of the traversal path and store it in a REQUEST variable. Not too bad, but SiteAccess is fragile (it doesn't work with Zope 2.2a). Cheers, Evan @ digicool & 4-am
Evan Simpson wrote:
3. Use a SiteAccess Access Rule on the folder, having it check to see if the next object to be traversed is your DTMLMethod. If so (and if the next name doesn't start with 'manage'!) remove the rest of the traversal path and store it in a REQUEST variable. Not too bad, but SiteAccess is fragile (it doesn't work with Zope 2.2a).
I was going to implement this as a seperate PathHandler product for Zope 2.2 when the beta comes out. someone has already sent me their alpha code for 2.1.x but it was apparently unstable. cheers, Chris PS: Evan is SiteAccess(or its replacement) going to ship as an 'official' product for Zope 2.2?
participants (3)
-
Chris Withers -
Evan Simpson -
Ian Sparks