[z3-five] Re: Using ztapi in FIve
Philipp von Weitershausen
philipp at weitershausen.de
Tue Apr 19 19:35:25 CEST 2005
Andreas Jung wrote:
>
> I have tried the following from the command line:
>
> from interfaces.stopwords import IStopwords
> from stopwords import StopwordUtility
>
> ztapi.provideUtility(IStopwords, StopwordUtility)
>
> ajung at localhost:~/sandboxes/Zope/Zope/lib/python/Products/TextIndexNG3: !py
> python2.3 shell.py
> Traceback (most recent call last):
> File "shell.py", line 23, in ?
> ztapi.provideUtility(IStopwords, StopwordUtility)
> File "/develop/sandboxes/Zope/Zope/lib/python/zope/app/tests/ztapi.py",
> line 81, in provideUtility
> s = zapi.getGlobalServices().getService(Utilities)
> File
> "/develop/sandboxes/Zope/Zope/lib/python/zope/component/service.py",
> line 109, in getService
> raise ComponentLookupError(name)
> zope.component.exceptions.ComponentLookupError: 'Utilities'
>
> Bug or feature?
Ah, dang. I forgot: Your TestCase needs to extend
zope.app.tests.placelesssetup.PlacelessSetup, or if you're in the
interpreter or using doctests, you need to call
zope.app.tests.placelesssetup.setUp() and .tearDown().
Philipp
More information about the z3-five
mailing list