E&S CVS Commit: PEAK - Configuration system cleanups and new features:

pje at eby-sarna.com pje at eby-sarna.com
Sat Nov 29 19:13:00 EST 2003


Module Name:	PEAK
Committed By:	pje
Date:		Sun Nov 30 00:12:28 UTC 2003

Modified Files:
	PEAK: CHANGES.txt
	PEAK/src/peak: peak.ini
	PEAK/src/peak/binding: once.py
	PEAK/src/peak/config: config_components.py
	PEAK/src/peak/config/tests: __init__.py

Log Message:
Configuration system cleanups and new features:

 - Replaced the "[Provide Utilities]" section of .ini files with
   "[Component Factories]".  The new section type is easier to use, much
   more versatile, and does all registration and imports lazily.  See the
   'peak.ini' file for docs.  "[Provide Utilities]" and
   'config.ProvideInstance()' are now DEPRECATED, so please convert ASAP.

 - 'binding.Make()' now accepts configuration keys, using them to look up a
   factory object that's then invoked to create the attribute.  This makes
   it a lot easier to define a component with its own transaction service,
   'IBasicReactor', or other normally "global" component.  It also makes it
   easier to globally specify a factory class for some interface.
   Factories are looked up under the 'config.FactoryFor(key)' configuration
   key.  (See below.)

 - Added 'config.FactoryFor(key)', a 'config.IConfigKey' implementation
   that provides a configuration namespace for factories.

   When you use 'binding.Make(ISomething)', it's roughly equivalent to::

        binding.Make(
            lambda self,d,a:
                binding.lookupComponent(
                    self, config.FactoryFor(ISomething),
                    adaptTo = binding.IRecipe
                )(self,d,a)
        )

   That is, the 'config.FactoryFor(ISomething)' is looked up and invoked.

 - Added 'config.CreateViaFactory(key)', a 'config.IRule' implementation
   that creates an implementation of 'key', by looking up
   'config.FactoryFor(key)'and invoking it.

 - Added 'config.ruleForExpr(name,expr)', that returns a 'config.IRule'
   that computes the Python expression in the string 'expr'.  This is the
   mechanism used by configuration files to create rules, factored out into
   an API call so that configuration extensions can use it, too.


To view diffs of this commit, you can use the following URL(s):
http://cvs.eby-sarna.com/PEAK/CHANGES.txt.diff?r1=1.102&r2=1.103
http://cvs.eby-sarna.com/PEAK/src/peak/peak.ini.diff?r1=1.92&r2=1.93
http://cvs.eby-sarna.com/PEAK/src/peak/binding/once.py.diff?r1=1.66&r2=1.67
http://cvs.eby-sarna.com/PEAK/src/peak/config/config_components.py.diff?r1=1.64&r2=1.65
http://cvs.eby-sarna.com/PEAK/src/peak/config/tests/__init__.py.diff?r1=1.25&r2=1.26

To generate a diff of this commit:
cvs rdiff -r1.102 -r1.103 PEAK/CHANGES.txt
cvs rdiff -r1.92 -r1.93 PEAK/src/peak/peak.ini
cvs rdiff -r1.66 -r1.67 PEAK/src/peak/binding/once.py
cvs rdiff -r1.64 -r1.65 PEAK/src/peak/config/config_components.py
cvs rdiff -r1.25 -r1.26 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