Hi All,

I think it would be generally usefull to keep a stack of traversed
objects. I currently need it in my application breadcrumb / navigation
generation.

I'm not speaking of a list of individual path elements but the actual
objects that were traversed.

Adding this functionality would be rather trivial (and I've already
implemented in my local TG), TG is already monkeypatching CP's
getObjFromPath (in startup.py), which does the basic traversing,
the following diff (against 0.8a5) implements this functionality.

If not accepted, I'll probably be monkeypatching CP or TG myself but
I'd rather avoid that :)


*** startup.py  2006-01-16 01:14:45.000000000 +0100
--- startup-new.py 2006-01-16 01:15:14.000000000 +0100
***************
*** 123,128 ****
--- 123,129 ----
      wp = webpath

      root = cherrypy
+     cherrypy.request.object_stack = []
      cherrypy.request.approot = "/" + wp
      for i in range(0, len(objPathList)):
          # maps virtual filenames to Python identifiers (substitutes
'.' for '_')
***************
*** 134,139 ****
--- 135,141 ----
              cherrypy.request.approot = "/" + wp +
"/".join(objPathList[1:i+1])          if root is None:
              return None
+         cherrypy.request.object_stack.append(root)
      return root

  def check_port(host, port):


--

Regards,

  Ivo

--
Drs. I.R. van der Wijk / m3r Consultancy B.V.
Linux/Python/Zope/Plone and Open Source solutions
PO-box 51091, 1007 EB Amsterdam, The Netherlands
Email: ivo <at> m3r.nl

Reply via email to