repoze.folder uses zope.component to send events. Don't take my word
but I think that in order to catch those events you would need to set
your pyramid application to use zope.component.
http://docs.pylonsproject.org/projects/pyramid/1.0/narr/zca.html#enabling-the-zca-global-api-by-using-the-zca-global-registry
Alternatively you could create your own event and send it explicitly
whenever you add something to the folder. I don't know how to make
custom pyramid events, but it shouldn't be too difficult.
--
Danny Navarro | http://dannynavarro.net
> --
> You received this message because you are subscribed to the Google Groups "pylons-discuss" group.
> To post to this group, send email to pylons-...@googlegroups.com.
> To unsubscribe from this group, send email to pylons-discus...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
>
>
config.hook_zca() works too without requiring using the global registry:
- C
>
> Rgds
>
> Tim
>
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "pylons-discuss" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/pylons-discuss/-/NSBSJ4ojZQ4J.
> To post to this group, send email to pylons-...@googlegroups.com.
> To unsubscribe from this group, send email to pylons-discuss
> +unsub...@googlegroups.com.
I was curious about how to write custom events in Pyramid so I toyed
around a bit and came up with this blog post:
http://blog.dannynavarro.net/2011/06/12/using-custom-events-in-pyramid/
In the example I show the events work properly without hooking the ZCA.
--
Danny Navarro | http://dannynavarro.net
> To unsubscribe from this group, send email to pylons-discus...@googlegroups.com.
I've read the documentation several times, but when you do something
with an external application it doesn't seem to behave the way you
would expect it. And it doesn't matter if you use the global or the
local registry. (It will always work when you use Pyramids registry,
so that's not the problem)
Check this out:
During configuration stage:
config = Configurator(settings=settings)
config.hook_zca()
config.include('pyramid_zcml')
config.load_zcml('voteit.core:configure.zcml') #contains workflow ZCML
stuff for repoze.workflow
In repoze.workflow.zcml.register_workflow (that registers the
workflows) I just added a statement that prints the result of the
zope.component.getSiteManager method.
This is what happends, according to my understanding (please correct
me if I'm wrong):
- config.hook_zca sets up Pyramids get_current_registry as hook for
zope.component.getSiteManager - that isn't committed/activated since
config.end() isn't run
- When i include the workflow, it's set up in the registry name
'global' (which is not the same as the global site manager which is
called 'base', as far as i can see)
- When configuration is done, config.end() commits the configuration
changes, and hooks get_current_registry from Pyramid as the method to
use for getSiteManager.
This has the effect that all methods, including repoze.workflow now
use the local registry. (In my case named the same as the app,
'voteit.core')
This also means that all configuration that was loaded before
config.end() was run exists in a registry that no code will ever use.
Am I missing something here? If this is the case, it would never be
possible to add any regular zope apps to pyramid during the config-
stage. Is there any way around this?
(Note: If i register the global registry as manager, the same problem
will occur since that change will be committed when config.end() is run)
Cheers,
Robin
12 jun 2011 kl. 02.55 skrev Chris McDonough:
> config.hook_zca() works too without requiring using the global
> registry:
>
> <http://docs.pylonsproject.org/projects/pyramid/1.0/narr/zca.html#enabling-the-zca-global-api-by-using-hook-zca
> >
>
> - C
>
--
Betahaus
gsm: +46 70-333 00 10
web: http://www.betahaus.net