Commit 5ff387a7 authored by Jim Fulton's avatar Jim Fulton

Added getitem on product dispatcher to make it possible

to call from DTML. This wants to be a getattr, but
getattr is hard so we're not going to do it yet.
parent 47ae05ff
......@@ -91,6 +91,11 @@ from string import rfind
class ProductDispatcher(Acquisition.Implicit):
" "
def __getitem__(self, name):
product=self.aq_acquire('_getProducts')()._product(name)
dispatcher=FactoryDispatcher(product, self.aq_parent)
return dispatcher.__of__(self)
def __bobo_traverse__(self, REQUEST, name):
product=self.aq_acquire('_getProducts')()._product(name)
dispatcher=FactoryDispatcher(product, self.aq_parent, REQUEST)
......@@ -99,13 +104,14 @@ class ProductDispatcher(Acquisition.Implicit):
class FactoryDispatcher(Acquisition.Implicit):
" "
def __init__(self, product, dest, REQUEST):
def __init__(self, product, dest, REQUEST=None):
if hasattr(product,'aq_base'): product=product.aq_base
self._product=product
self._d=dest
v=REQUEST['URL']
v=v[:rfind(v,'/')]
self._u=v[:rfind(v,'/')]
if REQUEST is not None:
v=REQUEST['URL']
v=v[:rfind(v,'/')]
self._u=v[:rfind(v,'/')]
def Destination(self):
"Return the destination for factory output"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment