On Mon, 2006-23-10 at 07:54 -0400, Jim Fulton wrote:
> > Seems strange to have to differentiate between
> > "regular" packages and egg-available packages.  Perhaps I'm expecting
> > too much from eggs... having been spoiled by jars.
> We aren't taking about import. We are talking about reading files.

Indeed, as am I.

> You can't use the same API for reading files from eggs (or jars) and
> for reading files from a file system.  The current package option
> reads data from the file system.

Right, this is where java's ClassLoader.getResource bridges things in
java-land.  It can load files from *anywhere* on the classpath,
including within jars.

> Perhaps we should change the package option so that it uses the pkg_resources
> API to load ZCML files from packages.  There are still cases where egg != 
> package
> that would need to be addressed specifically.

So pkg_resources isn't smart enough to either load from the filesystem
directly or from within an egg?  I guess it just does the egg part?
(basically half of what ClassLoader.getResource does)

> > Does the API which provides egg support have anything like this?
> > http://java.sun.com/javase/6/docs/api/java/lang/ClassLoader.html#getResource(java.lang.String)
> > 
> > If so, I would expect the ZCML loading mechanism to simply use that when
> > looking for zcml files.
> We're not taking about import or loading objects from Python modules. We're 
> talking about
> loading files.

ClassLoader.getResource is about loading files (images, raw data, etc)
that are contained on the java classpath.

Unless I'm totally off base here, my feeling is that Java has done a
nice job of dealing with this situation a long time ago.  Of course Java
has had jar support (and I believe ClassLoader.getResource support)
since java 1.1 and we're only just now getting egg support.  It seems to
me that egg support is rather useless if there isn't an abstraction API
(perhaps pkg_resources is this) that can load a file from anywhere not
caring if it's in an egg or not.

- Rocky

Rocky Burt
ServerZen Software -- http://www.serverzen.com
News About The Server (blog) -- http://www.serverzen.net

Attachment: signature.asc
Description: This is a digitally signed message part

Zope3-dev mailing list
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to