On Mon, 2010-05-03 at 23:33 -0400, Chris McDonough wrote:
> On Mon, 2010-05-03 at 12:55 -0700, Sam Brauer wrote:
> > Hi there!  I'm a long-time Zope 2 user finally trying to do a demo project 
> > with Repoze.bfg.  
> > First
> > off, congratulations to everyone developing Repoze!  You've really
> > cherry picked the best concepts from Zope and packaged them in a lean
> > modern framework.
> > 
> > My demo project was going along very well
> > until I tried to wire up some subscribers for repoze.folder events; my
> > subscriber callbacks don't seem to be firing.  After trying a few days
> > to figure out the problem, I think I need to ask for help.  I've tried
> > to come up with a small example to demonstrate the problem, and I'd be
> > very grateful for any help.  I feel like I'm missing something that
> > should be obvious.
> > 
> 
> Hi Sam,
> 
> The events sent by repoze.folder are "object events", which are events
> dispatched based on *two* interfaces (the context interface and the
> event interface).  Here's an example from KARL:
> 
>   <subscriber
>       for="repoze.lemonade.interfaces.IContent
>            repoze.folder.interfaces.IObjectAddedEvent"
>       handler=".subscribers.index_content"/>
> 
> Hopefully this helps, 

Sorry, I should have also provided the "subscribers.index_content"
function so you could see its argument list:

def index_content(obj, event):
    """ Index content (an IObjectAddedEvent subscriber) """
    catalog = find_catalog(obj)
    if catalog is not None:
        for node in postorder(obj):
            if is_content(obj):
                path = model_path(node)
                docid = getattr(node, 'docid', None)
                if docid is None:
                    docid = node.docid = catalog.document_map.add(path)
                else:
                    catalog.document_map.add(path, docid)
                catalog.index_doc(docid, node)


_______________________________________________
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev

Reply via email to