Relative products path not compatible with Five

Bug #326148 reported by Malthe Borch
2
Affects Status Importance Assigned to Milestone
Zope 2
Fix Released
Medium
Tres Seaver

Bug Description

In a deployment where zope.conf is not autogenerated, it's often convenient to express paths relative to the main deployment directory. However, the logic in Five that loads configuration files (ZCML) incorrectly handles products with a relative module path (__file__).

Attached is a patch that fixes the situation in Products.Five; it may not be the correct place to patch.

Revision history for this message
Malthe Borch (mborch) wrote :
Revision history for this message
Tres Seaver (tseaver) wrote : Re: [Bug 326148] [NEW] Relative products path not compatible with Five

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Malthe wrote:
> Public bug reported:
>
> In a deployment where zope.conf is not autogenerated, it's often
> convenient to express paths relative to the main deployment directory.
> However, the logic in Five that loads configuration files (ZCML)
> incorrectly handles products with a relative module path (__file__).
>
> Attached is a patch that fixes the situation in Products.Five; it may
> not be the correct place to patch.

Maybe the better place in in the 'App.Products' bits which calls the
product's 'initialize' at startup (OFS.Applciation.install_product).
A test would be nice, too. ;)

Tres.
- --
===================================================================
Tres Seaver +1 540-429-0999 <email address hidden>
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJjDhz+gerLs4ltQ4RAuyvAJ9O8gji8xc9mmZ5rqt5RhU3n56+KQCgvlx+
7i+TjbyQT+vU9at4SYgz5DE=
=lEIP
-----END PGP SIGNATURE-----

Revision history for this message
Malthe Borch (mborch) wrote :

Excellent, I'll get a patch uploaded here for review on Monday, along with a test.

Revision history for this message
Malthe Borch (mborch) wrote :

Seems to correct place to patch is in the ``import_product`` method, since not all products get installed.

Revision history for this message
Malthe Borch (mborch) wrote :

I can't seem to run the OFS tests on my system, but here's an updated patch (without any test, because I can't run it).

Revision history for this message
Tres Seaver (tseaver) wrote : Re: [Bug 326148] Re: Relative products path not compatible with Five

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Malthe wrote:
> I can't seem to run the OFS tests on my system, but here's an updated
> patch (without any test, because I can't run it).
>
>
>
> ** Attachment added: "Updated patch for the OFS module"
> http://launchpadlibrarian.net/22433299/patch.diff

OK, a little more digging: I think the correct place to fix the
underlying problem (relative paths on Products.__path__) is inside the
ZConfig handler. 'root_handler()', located in
src/Zope2/Startup/handlers.py. If we absolutize the paths which come
from the config file at startup time, then we don't have to whack-a-mole
the places in App.Products / OFS.Application which might import products.

Tres.
- --
===================================================================
Tres Seaver +1 540-429-0999 <email address hidden>
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJkXO5+gerLs4ltQ4RAob8AKCt+pOnBDPp/pIvA+qnwjt84XJ+TgCeJQ54
7x+TxqN2VGKPtAWnfbn1ylg=
=Jmdi
-----END PGP SIGNATURE-----

Revision history for this message
Tres Seaver (tseaver) wrote :

Can you please verify that the attached patch fixes the issue for you?

The patch is against the 2.12 branch, but should also apply cleanly to the trunk.

Changed in zope2:
assignee: nobody → Tres Seaver (tseaver)
importance: Undecided → Medium
status: New → Confirmed
Tres Seaver (tseaver)
Changed in zope2:
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.