[Grok-dev] five.grok - what changed to break this?
sylvain at infrae.com
sylvain at infrae.com
Sat Sep 27 02:04:27 EDT 2008
> Martin Aspeli wrote:
>
Good morning,
>> I struggle to guess what that adapter may be or why there's two of it,
>> but my guess would be the static/ folder stuff?
>
> Turns out to be a good guess. I've just checked in a workaround for some
> code that was obviously broken:
>
> Index: src/five/grok/meta.py
> ===================================================================
> --- src/five/grok/meta.py (revision 91534)
> +++ src/five/grok/meta.py (working copy)
> @@ -59,16 +59,18 @@
> "resource directory and a module named "
> "'static.py'", module_info.getModule())
>
> - # FIXME: This is public, we need to set security on resources ?
> - name = module_info.dotted_name
> - resource_factory = components.DirectoryResourceFactory(
> - name, resource_path)
> - adapts = (IDefaultBrowserLayer,)
> - provides = interface.Interface
> + # FIXME: This is public, we need to set security on resources
> ?
> + name = module_info.dotted_name
> + resource_factory = components.DirectoryResourceFactory(
> + name, resource_path)
> + adapts = (IDefaultBrowserLayer,)
> + provides = interface.Interface
>
> - config.action(
> - discriminator=('adapter', adapts, provides, name),
> - callable=component.provideAdapter,
> - args=(resource_factory, adapts, provides, name),
> - )
> - return True
> + config.action(
> + discriminator=('adapter', adapts, provides, name),
> + callable=component.provideAdapter,
> + args=(resource_factory, adapts, provides, name),
> + )
> + return True
> +
> + return False
> \ No newline at end of file
>
> That is, it was registering the 'static' resource directory adapter even
> when there was no 'static/' directory to be found!
>
It's done the same in Grok. I think that's if the developer wants to add
a directory afterwards, he don't have to restart his instance.
> I didn't break any tests with this change. I should've written a failing
> test to prove it, but I don't have time for that right now and I need my
> instance to start up. :)
>
Well, you didn't break any test, since tests are checking that there is
an adapter for a static directory is registered, and it's the case, the
Zope 3 one, which don't work in Zope 2.
Best regards,
Sylvain,
More information about the Grok-dev
mailing list