[Repoze-dev] plugging in a new scanner
Hi All, I'd like to plug in my own decorator (as a way of wiring a method to recieve stomp messages from a particular queue as it happens) to the config.scan() machinery. Are there docs or a recommended way to do this? cheers, Chris -- Simplistix - Content Management, Batch Processing Python Consulting - http://www.simplistix.co.uk ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] Problem with repoze.what-pylons sample application
Am Montag 12 April 2010 21:05:36 schrieb Tres Seaver: Phenex wrote: Hi, i am unable to run the sample application of the repoze.what pylons integration. I get a bunch of error from paste i do not understant what went went wrong. After i failed to get the new version to run (the old one hase problems with unicode usernames but worked fine with the rest, so i installed the actual one via pip), i tried it with the sample. I run Ubuntu Karmic with python 2.6 and all moduls in newest version inside an virtuelenv. I give the traceback here: (pylons)phe...@phenex-laptop:~/Programmiererung/Web/pylone- tests/PylonsSecuredApp$ clear; paster setup-app development.ini Traceback (most recent call last): File /home/phenex/.virtualenv/pylons/bin/paster, line 8, in module load_entry_point('PasteScript==1.7.3', 'console_scripts', 'paster')() File /home/phenex/.virtualenv/pylons/lib/python2.6/site- packages/paste/script/command.py, line 84, in run invoke(command, command_name, options, args[1:]) File /home/phenex/.virtualenv/pylons/lib/python2.6/site- packages/paste/script/command.py, line 123, in invoke exit_code = runner.run(args) File /home/phenex/.virtualenv/pylons/lib/python2.6/site- packages/paste/script/appinstall.py, line 68, in run return super(AbstractInstallCommand, self).run(new_args) File /home/phenex/.virtualenv/pylons/lib/python2.6/site- packages/paste/script/command.py, line 218, in run result = self.command() File /home/phenex/.virtualenv/pylons/lib/python2.6/site- packages/paste/script/appinstall.py, line 447, in command conf = appconfig(config_spec, relative_to=os.getcwd()) File /home/phenex/.virtualenv/pylons/lib/python2.6/site- packages/paste/deploy/loadwsgi.py, line 215, in appconfig global_conf=global_conf) File /home/phenex/.virtualenv/pylons/lib/python2.6/site- packages/paste/deploy/loadwsgi.py, line 248, in loadcontext global_conf=global_conf) File /home/phenex/.virtualenv/pylons/lib/python2.6/site- packages/paste/deploy/loadwsgi.py, line 278, in _loadconfig return loader.get_context(object_type, name, global_conf) File /home/phenex/.virtualenv/pylons/lib/python2.6/site- packages/paste/deploy/loadwsgi.py, line 409, in get_context section) File /home/phenex/.virtualenv/pylons/lib/python2.6/site- packages/paste/deploy/loadwsgi.py, line 431, in _context_from_use object_type, name=use, global_conf=global_conf) File /home/phenex/.virtualenv/pylons/lib/python2.6/site- packages/paste/deploy/loadwsgi.py, line 361, in get_context global_conf=global_conf) File /home/phenex/.virtualenv/pylons/lib/python2.6/site- packages/paste/deploy/loadwsgi.py, line 248, in loadcontext global_conf=global_conf) File /home/phenex/.virtualenv/pylons/lib/python2.6/site- packages/paste/deploy/loadwsgi.py, line 285, in _loadegg return loader.get_context(object_type, name, global_conf) File /home/phenex/.virtualenv/pylons/lib/python2.6/site- packages/paste/deploy/loadwsgi.py, line 561, in get_context object_type, name=name) File /home/phenex/.virtualenv/pylons/lib/python2.6/site- packages/paste/deploy/loadwsgi.py, line 581, in find_egg_entry_point pkg_resources.require(self.spec) File /home/phenex/.virtualenv/pylons/lib/python2.6/site- packages/pkg_resources.py, line 666, in require needed = self.resolve(parse_requirements(requirements)) File /home/phenex/.virtualenv/pylons/lib/python2.6/site- packages/pkg_resources.py, line 565, in resolve raise DistributionNotFound(req) # XXX put more info here pkg_resources.DistributionNotFound: PylonsSecuredApp --- Any ideas? I just tried to reprodue this in a clean virtualenv: $ uname -a Linux scout 2.6.28-18-generic #60-Ubuntu SMP Fri Mar 12 04:40:52 UTC\ 2010 i686 GNU/Linux $ /opt/Python-2.6.5/bin/virtualenv --no-site-packages \ --unzip-setuptools /tmp/phenex New python executable in /tmp/phenex/bin/python Installing setuptools.done. $ cd /tmp/phenex $ bin/easy_install Pylons repoze.what Finished processing dependencies for repoze.what $ mkdir src $ cd src $ ../bin/paster create -t pylons phenex ... Copying templates/default_project/test.ini_tmpl to ./phenex/test.ini Running /tmp/phenex/bin/python setup.py egg_info $ cd phenex $ ../../bin/paster setup-app development.ini Running setup_config() from phenex.websetup Until sometime last week, the released version of repoze.what (1.0.8) was incomptible with the latest repoze.who releast (2.0a2). The currently released repoze.what (1.0.9) now pins repoze.who (effectively to the last 1.0.x release). Can you try upgrading repoze.what, which should then downgrade repoze.who, and see if it makes your problem go away? Tres. Yeah, this solved the problem. Thank jou so much.
Re: [Repoze-dev] plugging in a new scanner
On 4/13/10 4:15 AM, Chris Withers wrote: Hi All, I'd like to plug in my own decorator (as a way of wiring a method to recieve stomp messages from a particular queue as it happens) to the config.scan() machinery. Are there docs or a recommended way to do this? No. It's hardcoded. I think we should make it not-hardcoded for 1.3. - C ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
[Repoze-dev] ZCA registry confusion
Hi, I have some custom middleware that is intended to use the same ZCA registry as my bfg app. I've altered the run.py in the bfg app to tell it to use the global site manager, and the middleware looks up utilities by doing self.gsm = getGlobalSiteManager() self.gsm.queryUtility etc This is all working fine for the app. But recently my isolated tests stopped working. I know the environment is different now, new bfg, newer release of zope.component, but I can't figure out how to make them work anymore. I want the following to give me a registry populated from the configure.zcml file in the pets packag, but instead it seems to be empty: def test_gsm_setup(self): test_gsm_setup - test that we can setup a zca registry from the model file import pets xmlconfig.file('configure.zcml', package=pets) gsm = getGlobalSiteManager() assert sm._utility_registrations If anyone can point me at docs or tutorials or suggest what I am doing wrong that would be great. thanks Iain ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] ZCA registry confusion
On 4/13/10 7:17 PM, Chris McDonough wrote: On 4/13/10 7:03 PM, Iain Duncan wrote: Hi, I have some custom middleware that is intended to use the same ZCA registry as my bfg app. I've altered the run.py in the bfg app to tell it to use the global site manager, and the middleware looks up utilities by doing self.gsm = getGlobalSiteManager() self.gsm.queryUtility etc This is all working fine for the app. But recently my isolated tests stopped working. I know the environment is different now, new bfg, newer release of zope.component, but I can't figure out how to make them work anymore. I want the following to give me a registry populated from the configure.zcml file in the pets packag, but instead it seems to be empty: def test_gsm_setup(self): test_gsm_setup - test that we can setup a zca registry from the model file import pets xmlconfig.file('configure.zcml', package=pets) gsm = getGlobalSiteManager() assert sm._utility_registrations Use the pattern from http://docs.repoze.org/bfg/1.2/narr/unittesting.html#test-set-up-and-tear-down instead, but extend it just like you did for your BFG app at startup time, e.g.: def test_gsm_setup(self): from repoze.bfg.configuration import Configurator from zope.component import getGlobalSiteManager gsm = getGlobalSiteManager() self.config.begin() self.config.load_zcml('pets:configure.zcml') self.config.end() assert gsm._utility_registrations - C Crap. There should be a self.config = Configurator() in there. Hopefully you get the idea. - C -- Chris McDonough Agendaless Consulting, Fredericksburg VA The repoze.bfg Web Application Framework Book: http://bfg.repoze.org/book ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] ZCA registry confusion
On 4/13/10 9:22 PM, Iain Duncan wrote: Ok, I think a better way to phrase mine is: - is it safe and/or reasonable to use the repoze.bfg configurator to setup up the global ZCA registry for non-bfg uses? It is not reasonable. It is possible, though. - C ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] ZCA registry confusion
On Tue, Apr 13, 2010 at 7:10 PM, Chris McDonough chr...@plope.com wrote: On 4/13/10 9:22 PM, Iain Duncan wrote: Ok, I think a better way to phrase mine is: - is it safe and/or reasonable to use the repoze.bfg configurator to setup up the global ZCA registry for non-bfg uses? It is not reasonable. It is possible, though. - C Does anyone have the time to point me at how I should do it? I've been googling quite a bit but don't seem to be finding much in the way of examples of setting up a zca registry from zcml files. From what I could tell, the code I posted looked like it ought to populate the global site manager, but when I do: xmlconfig.file('configure.zcml', package=pets) gsm = getGlobalSiteManager() # or sm = getSiteManager() both gsm and sm seem to be empty. thanks iain ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev