Re: [Repoze-dev] using bfg app as wsgi callable in other frameworks?
On 8/28/09 2:24 PM, Iain Duncan wrote: > On Fri, 2009-08-28 at 14:07 -0400, Chris McDonough wrote: >> Hi Iain, >> >> Use an ini file setting in your bfg app's paste.ini section like: >> >> configure_zcml = /path/to/configure.zcml > > Would this also work if put in a pylons ini file? Or do you know what > else one would need to do to make it work? See http://docs.repoze.org/bfg/current/narr/startup.html#the-startup-process See in particular the first code example in there that starts with "from repoze.bfg.router import make_app". Note that the "app" function in there (which happens to be a paster app entry point) calls make_app with **kw, passing it in to make_app as "options". **kw there represents the ini parameters that come from the paste.ini file app section. So something like: make_app(some_root_factory, mypackage, options={'configure_zcml':'/path/to/configure.zcml') .. would do something. ;-) Putting stuff into Pylons' .ini file is fine, but you'll need to pull it out and call make_app by hand to get a bfg app if you do that. > Thanks so much for the help Chris, that oughta keep me going. I hope > this thing I'm cooking up can eventually be useful to the repoze > community. The more zope I learn the more I love bfg! =) Good luck! - C ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] using bfg app as wsgi callable in other frameworks?
On Fri, 2009-08-28 at 14:07 -0400, Chris McDonough wrote: > Hi Iain, > > Use an ini file setting in your bfg app's paste.ini section like: > > configure_zcml = /path/to/configure.zcml Would this also work if put in a pylons ini file? Or do you know what else one would need to do to make it work? > > This can also be controlled with an environment variable. See > http://docs.repoze.org/bfg/current/narr/environment.html#environment-chapter > for > more information about the "configure_zcml" .ini file setting. > > See also http://docs.repoze.org/bfg/current/narr/extending.html for more > conceptual info about this sort of thing. Thanks so much for the help Chris, that oughta keep me going. I hope this thing I'm cooking up can eventually be useful to the repoze community. The more zope I learn the more I love bfg! =) Iain > > On 8/28/09 1:56 PM, Iain Duncan wrote: > > On Fri, 2009-08-28 at 13:43 -0400, Chris McDonough wrote: > >> The bfg "repoze.bfg.router.make_app", used by most application paster entry > >> point functions, returns a Router object. This is just a fancy WSGI > >> application. Call make_app from within Pylons to get a WSGI app, serve > >> that > >> WSGI app via some Pylons controller. > >> > >> Other than that, with respect to application model-agnosticism, I don't > >> really > >> understand the pattern, nor what you're trying to achieve. But you can > >> use full > >> paths in configure.zcml (e.g. rather than ".model.foo", use > >> "mypackage.model.foo"). > > > > Thanks Chris. What I'm wondering is how my call to make_app knows to > > parse and use my configure.zcml(s). From the test example it looks like > > I just need to do: > > > > import zope.configuration.xmlconfig > > zope.configuration.xmlconfig.file('configure.zcml', package=my_pkg) > > > > Thought I'm not sure where this should be done. Once at the top project > > level? > > > > thanks > > Iain > > > >> > >> - C > >> > >> > >> On 8/28/09 12:59 PM, Iain Duncan wrote: > >>> ( apologies if this is a duplicate, it doesn't seem to have made it to > >>> me through the list so resending ) > >>> > >>> Hi folks, I have a bfg app that makes a crud controller, where objects > >>> from the model package get attached through configure.zcml. This > >>> achieves my purpose of having the application completely unaware of the > >>> model. I want to use this app as a wsgi callable in another app ( a > >>> pylons project ), but I'm stuck on a few things with my limited wsgi > >>> knowledge: > >>> > >>> - I understand that run:app provides the paster entry point, but how > >>> would I import my whole app into another python app? > >>> - I want my model to be installable as a separate, framework agnostic, > >>> sqlalchemy model, that only needs to import interfaces from the crud > >>> apps interfaces module > >>> - configure.zcml hooks things up right now with calls like: > >>> > >>> >>> provides=".model.pet.IPet" > >>> component=".model.pet.Pet" > >>> name="pet" > >>> /> > >>> >>> factory=".model.pet.PetFields" > >>> for=".model.pet.IPet .interfaces.IActionView > >>> repoze.bfg.interfaces.IRequest" /> > >>> > >>> But I'm at a loss as to how I make this app know to look in a > >>> configure.zcml file in the model package without touching the stuff in > >>> the app itself? > >>> > >>> Thanks! > >>> Iain > >>> > >>> > >>> ___ > >>> Repoze-dev mailing list > >>> Repoze-dev@lists.repoze.org > >>> http://lists.repoze.org/listinfo/repoze-dev > >>> > >> > >> ___ > >> Repoze-dev mailing list > >> Repoze-dev@lists.repoze.org > >> http://lists.repoze.org/listinfo/repoze-dev > > > ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] using bfg app as wsgi callable in other frameworks?
Hi Iain, Use an ini file setting in your bfg app's paste.ini section like: configure_zcml = /path/to/configure.zcml This can also be controlled with an environment variable. See http://docs.repoze.org/bfg/current/narr/environment.html#environment-chapter for more information about the "configure_zcml" .ini file setting. See also http://docs.repoze.org/bfg/current/narr/extending.html for more conceptual info about this sort of thing. On 8/28/09 1:56 PM, Iain Duncan wrote: > On Fri, 2009-08-28 at 13:43 -0400, Chris McDonough wrote: >> The bfg "repoze.bfg.router.make_app", used by most application paster entry >> point functions, returns a Router object. This is just a fancy WSGI >> application. Call make_app from within Pylons to get a WSGI app, serve that >> WSGI app via some Pylons controller. >> >> Other than that, with respect to application model-agnosticism, I don't >> really >> understand the pattern, nor what you're trying to achieve. But you can use >> full >> paths in configure.zcml (e.g. rather than ".model.foo", use >> "mypackage.model.foo"). > > Thanks Chris. What I'm wondering is how my call to make_app knows to > parse and use my configure.zcml(s). From the test example it looks like > I just need to do: > > import zope.configuration.xmlconfig > zope.configuration.xmlconfig.file('configure.zcml', package=my_pkg) > > Thought I'm not sure where this should be done. Once at the top project > level? > > thanks > Iain > >> >> - C >> >> >> On 8/28/09 12:59 PM, Iain Duncan wrote: >>> ( apologies if this is a duplicate, it doesn't seem to have made it to >>> me through the list so resending ) >>> >>> Hi folks, I have a bfg app that makes a crud controller, where objects >>> from the model package get attached through configure.zcml. This >>> achieves my purpose of having the application completely unaware of the >>> model. I want to use this app as a wsgi callable in another app ( a >>> pylons project ), but I'm stuck on a few things with my limited wsgi >>> knowledge: >>> >>> - I understand that run:app provides the paster entry point, but how >>> would I import my whole app into another python app? >>> - I want my model to be installable as a separate, framework agnostic, >>> sqlalchemy model, that only needs to import interfaces from the crud >>> apps interfaces module >>> - configure.zcml hooks things up right now with calls like: >>> >>> >> provides=".model.pet.IPet" >>> component=".model.pet.Pet" >>> name="pet" >>> /> >>> >> factory=".model.pet.PetFields" >>> for=".model.pet.IPet .interfaces.IActionView >>> repoze.bfg.interfaces.IRequest" /> >>> >>> But I'm at a loss as to how I make this app know to look in a >>> configure.zcml file in the model package without touching the stuff in >>> the app itself? >>> >>> Thanks! >>> Iain >>> >>> >>> ___ >>> Repoze-dev mailing list >>> Repoze-dev@lists.repoze.org >>> http://lists.repoze.org/listinfo/repoze-dev >>> >> >> ___ >> Repoze-dev mailing list >> Repoze-dev@lists.repoze.org >> http://lists.repoze.org/listinfo/repoze-dev > ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] using bfg app as wsgi callable in other frameworks?
On Fri, 2009-08-28 at 13:43 -0400, Chris McDonough wrote: > The bfg "repoze.bfg.router.make_app", used by most application paster entry > point functions, returns a Router object. This is just a fancy WSGI > application. Call make_app from within Pylons to get a WSGI app, serve that > WSGI app via some Pylons controller. > > Other than that, with respect to application model-agnosticism, I don't > really > understand the pattern, nor what you're trying to achieve. But you can use > full > paths in configure.zcml (e.g. rather than ".model.foo", use > "mypackage.model.foo"). Thanks Chris. What I'm wondering is how my call to make_app knows to parse and use my configure.zcml(s). From the test example it looks like I just need to do: import zope.configuration.xmlconfig zope.configuration.xmlconfig.file('configure.zcml', package=my_pkg) Thought I'm not sure where this should be done. Once at the top project level? thanks Iain > > - C > > > On 8/28/09 12:59 PM, Iain Duncan wrote: > > ( apologies if this is a duplicate, it doesn't seem to have made it to > > me through the list so resending ) > > > > Hi folks, I have a bfg app that makes a crud controller, where objects > > from the model package get attached through configure.zcml. This > > achieves my purpose of having the application completely unaware of the > > model. I want to use this app as a wsgi callable in another app ( a > > pylons project ), but I'm stuck on a few things with my limited wsgi > > knowledge: > > > > - I understand that run:app provides the paster entry point, but how > > would I import my whole app into another python app? > > - I want my model to be installable as a separate, framework agnostic, > > sqlalchemy model, that only needs to import interfaces from the crud > > apps interfaces module > > - configure.zcml hooks things up right now with calls like: > > > > >provides=".model.pet.IPet" > >component=".model.pet.Pet" > >name="pet" > > /> > > > factory=".model.pet.PetFields" > > for=".model.pet.IPet .interfaces.IActionView > > repoze.bfg.interfaces.IRequest" /> > > > > But I'm at a loss as to how I make this app know to look in a > > configure.zcml file in the model package without touching the stuff in > > the app itself? > > > > Thanks! > > Iain > > > > > > ___ > > Repoze-dev mailing list > > Repoze-dev@lists.repoze.org > > http://lists.repoze.org/listinfo/repoze-dev > > > > ___ > Repoze-dev mailing list > Repoze-dev@lists.repoze.org > http://lists.repoze.org/listinfo/repoze-dev ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] using bfg app as wsgi callable in other frameworks?
The bfg "repoze.bfg.router.make_app", used by most application paster entry point functions, returns a Router object. This is just a fancy WSGI application. Call make_app from within Pylons to get a WSGI app, serve that WSGI app via some Pylons controller. Other than that, with respect to application model-agnosticism, I don't really understand the pattern, nor what you're trying to achieve. But you can use full paths in configure.zcml (e.g. rather than ".model.foo", use "mypackage.model.foo"). - C On 8/28/09 12:59 PM, Iain Duncan wrote: > ( apologies if this is a duplicate, it doesn't seem to have made it to > me through the list so resending ) > > Hi folks, I have a bfg app that makes a crud controller, where objects > from the model package get attached through configure.zcml. This > achieves my purpose of having the application completely unaware of the > model. I want to use this app as a wsgi callable in another app ( a > pylons project ), but I'm stuck on a few things with my limited wsgi > knowledge: > > - I understand that run:app provides the paster entry point, but how > would I import my whole app into another python app? > - I want my model to be installable as a separate, framework agnostic, > sqlalchemy model, that only needs to import interfaces from the crud > apps interfaces module > - configure.zcml hooks things up right now with calls like: > > provides=".model.pet.IPet" >component=".model.pet.Pet" >name="pet" > /> > factory=".model.pet.PetFields" > for=".model.pet.IPet .interfaces.IActionView > repoze.bfg.interfaces.IRequest" /> > > But I'm at a loss as to how I make this app know to look in a > configure.zcml file in the model package without touching the stuff in > the app itself? > > Thanks! > Iain > > > ___ > Repoze-dev mailing list > Repoze-dev@lists.repoze.org > http://lists.repoze.org/listinfo/repoze-dev > ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
[Repoze-dev] using bfg app as wsgi callable in other frameworks?
( apologies if this is a duplicate, it doesn't seem to have made it to me through the list so resending ) Hi folks, I have a bfg app that makes a crud controller, where objects from the model package get attached through configure.zcml. This achieves my purpose of having the application completely unaware of the model. I want to use this app as a wsgi callable in another app ( a pylons project ), but I'm stuck on a few things with my limited wsgi knowledge: - I understand that run:app provides the paster entry point, but how would I import my whole app into another python app? - I want my model to be installable as a separate, framework agnostic, sqlalchemy model, that only needs to import interfaces from the crud apps interfaces module - configure.zcml hooks things up right now with calls like: But I'm at a loss as to how I make this app know to look in a configure.zcml file in the model package without touching the stuff in the app itself? Thanks! Iain ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev