[Zope-CMF] CMF: registerDirectory case sensitive ?
Charlie Clark
charlie.clark at clark-consulting.eu
Sun May 30 10:23:52 EDT 2010
Am 30.05.2010, 16:13 Uhr, schrieb Fritz Loseries <fritz at loseries.info>:
> Hi,
> I just got a problem where I think that there is a conflict with case
> sensitive registration.
> Through zcml I've registered "Filesystem Directory Views" using
> Uppercase for the first letter:
> <cmf:registerDirectory name="mytheme_images/Stammbaeume"/>
> <cmf:registerDirectory name="mytheme_images/Stammbaeume/Koschmieder"/>
> Then I've imported some document.zexp from another site.
> Within HTML code src of img is "../stammbaeume/koschmieder/img/image.png"
> Image will not be presented, because now image.png is no longer in the
> subdir img.
> Changing it to "../stammbaeume/koschmieder/image.png"
> Image will not be presented, because it is case sensitive.
> Changing it to "../Stammbaeume/Koschmieder/image.png"
> Image appears
> But changing all src of img in a mass of documents is an unpracticable
> way.
Why is it unpractical? If you know the exact pattern to replace it should
be easy enough to do this using a script.
> Thus I decided to change registration through zcml.
> <cmf:registerDirectory name="mytheme_images/stammbaeume"/>
> <cmf:registerDirectory name="mytheme_images/stammbaeume/koschmieder"/>
> <cmf:registerDirectory
> name="mytheme_images/stammbaeume/koschmieder/img"/>
> and moving images to subdir img, as well as changing case of directory
> naming to lower case.
> Restarting Zope again, using original version of the CMF document, no
> image appears.
> But I got following warning:
> /usr/local/Plone/buildout-cache/eggs/Products.CMFCore-2.1.2-py2.4.egg/Products/CMFCore/DirectoryView.py:497:
> UserWarning: DirectoryView img refers to a non-existing path
> 'CMFPlone/skins/custom_image/Stammbaeume/Koschmieder'
> (self.id, reg_key), UserWarning)
> Through ZMI content of Stammbaeume/Koschmieder/img is accessible.
> This seems for me, that deleting a "Filesystem Directory View" and
> restarting Zope (running zcml) will not empty and refill the registry.
> Now I got a real conflict. I do not know, if this is a bug or if I can
> get an advice how to change it through GenericSetup.
Firstly, all Zope URLs are case-sensitive. Directory Views are nothing
more than storages for Zope objects in the file system. Secondly, you need
to do more than just register the directory in ZCML. This just makes them
available for the ZODB object of the File Directory View. Once you've
registered the new directory you can assign it to the relevant Filesystem
Directory View through its properties, or indeed using GenericSetup.
Charlie
--
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-600-3657
Mobile: +49-178-782-6226
More information about the Zope-CMF
mailing list