Re: [Repoze-dev] would like to registerViews in python but not via decorator

2009-11-25 Thread Chris McDonough
Tim Hoffman wrote:
 Hi Chris
 
 I am trying to register some views directly through python and not
 using the view decorator,
 I have tried using code very similiar to repoze.bfg.testing.
 
 However after doing so, whilst I can look the view up by doing
 a zope.component.queryMultiAdapter((context,request),IView,name=myview)
 and alternately getting the site manager first.
 
 However the router never seems to be able to find the views I have
 registered in this fashion.

Sorry for not responding sooner Tim.

I'm not sure how this is; it may be that your registrations are getting in to 
the wrong registry.  Try using repoze.bfg.threadlocal.get_current_registry() 
instead of zope.component.getSiteManager() to retrieve the registry before you 
add stuff to it maybe?

Note that the trunk has facilities out of the box for this (although it's still 
under heavy development):

http://docs.repoze.org/bfg/trunk/narr/configuration.html#hello-world-configured-imperatively


- C

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


Re: [Repoze-dev] would like to registerViews in python but not via decorator

2009-11-25 Thread Tim Hoffman
Hi Chris

Yeah I figured I as getting the wrong registry, and in fact I was if I
try and register stuff too early it all went in to the wrong bucket.

I am still having some problems looking stuff up.  I can manually look
stuff up with 
zope.component.queryMultiAdapter((context,request),IView,name=myview)
but the primary views that the router is doing a lookup using lookup()
still fail to be found,  the few zcml based views left around like
NotFound
are being found (and that template calls a couple of
zope.component.queryMultiAdapter((context,request),IView,name=myview)
in it to get
various fragments so I now everything is in the same registry.

It seems the lookup code in router hits the cache and then doesn't
seem to successfully find the views I have registered explicitly

I will keep digging.  Its becoming pretty important that I reduce
start up costs as much as possible

T


On Thu, Nov 26, 2009 at 4:43 AM, Chris McDonough chr...@plope.com wrote:
 Tim Hoffman wrote:

 Hi Chris

 I am trying to register some views directly through python and not
 using the view decorator,
 I have tried using code very similiar to repoze.bfg.testing.

 However after doing so, whilst I can look the view up by doing
 a zope.component.queryMultiAdapter((context,request),IView,name=myview)
 and alternately getting the site manager first.

 However the router never seems to be able to find the views I have
 registered in this fashion.

 Sorry for not responding sooner Tim.

 I'm not sure how this is; it may be that your registrations are getting in
 to the wrong registry.  Try using
 repoze.bfg.threadlocal.get_current_registry() instead of
 zope.component.getSiteManager() to retrieve the registry before you add
 stuff to it maybe?

 Note that the trunk has facilities out of the box for this (although it's
 still under heavy development):

 http://docs.repoze.org/bfg/trunk/narr/configuration.html#hello-world-configured-imperatively


 - C


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