E&S CVS Commit: PEAK - Changes to make it possible to use PEAK and PEAK apps' package data files

pje at eby-sarna.com pje at eby-sarna.com
Fri Oct 8 12:39:00 EDT 2004


Module Name:	PEAK
Committed By:	pje
Date:		Fri Oct  8 16:38:01 UTC 2004

Modified Files:
	PEAK: CHANGES.txt
	PEAK/src/peak/config: config_components.py ini_files.py interfaces.py
	    load_zconfig.py
	PEAK/src/peak/config/tests: __init__.py

Log Message:
Changes to make it possible to use PEAK and PEAK apps' package data files
from .zip files:

- 'config.fileNearModule()' is DEPRECATED; use 'config.packageFile()' now.
   The latter returns a 'naming.IStreamFactory', which is more suitable for
   working with e.g. module data files compressed in a zipfile.  Uses of
   'fileNearModule()' that were being passed to 'config.loadConfigFile()'
   can be safely changed to 'config.packageFile()' without needing any
   other code changes, but if you were directly using 'fileNearModule()'
   as a filename, you will need to rewrite appropriately.

 - 'config.loadConfigFile()' and 'config.loadConfigFiles()' now accept
   URLs, 'naming.IStreamFactory' objects, and 'config.IStreamSource'
   objects as well as filenames.  This was primarily added to support use
   of 'config.packageFile()' or 'pkgfile:' URLs, in place of using
   'config.fileNearModule()'.  (ZConfig loaders support this too.)

 - There is a new 'config.IStreamSource' protocol, to make it easy to
   accept URLs, filenames, or 'naming.IStreamFactory' objects as the source
   of a "file".

   Its typical usage is just::

       factory = config.IStreamSource(data).getFactory(self)
       stream = factory.open('t')  # open for reading in text mode

   where 'data' is a string or a 'naming.IStreamFactory', and 'self' is a
   component to be used as lookup context.  The returned 'factory' is a
   'naming.IStreamFactory' that can then be '.open()'-ed for reading, or
   used in other ways as needed.

   Wherever practical, as we encounter them, we'll be changing PEAK API's
   that take filenames to also accept stream sources.


To view diffs of this commit, you can use the following URL(s):
http://cvs.eby-sarna.com/PEAK/CHANGES.txt.diff?r1=1.149&r2=1.150
http://cvs.eby-sarna.com/PEAK/src/peak/config/config_components.py.diff?r1=1.81&r2=1.82
http://cvs.eby-sarna.com/PEAK/src/peak/config/ini_files.py.diff?r1=1.8&r2=1.9
http://cvs.eby-sarna.com/PEAK/src/peak/config/interfaces.py.diff?r1=1.38&r2=1.39
http://cvs.eby-sarna.com/PEAK/src/peak/config/load_zconfig.py.diff?r1=1.14&r2=1.15
http://cvs.eby-sarna.com/PEAK/src/peak/config/tests/__init__.py.diff?r1=1.34&r2=1.35

To generate a diff of this commit:
cvs rdiff -r1.149 -r1.150 PEAK/CHANGES.txt
cvs rdiff -r1.81 -r1.82 PEAK/src/peak/config/config_components.py
cvs rdiff -r1.8 -r1.9 PEAK/src/peak/config/ini_files.py
cvs rdiff -r1.38 -r1.39 PEAK/src/peak/config/interfaces.py
cvs rdiff -r1.14 -r1.15 PEAK/src/peak/config/load_zconfig.py
cvs rdiff -r1.34 -r1.35 PEAK/src/peak/config/tests/__init__.py

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.




More information about the source-changes mailing list