|
|
Changed, Enhanced, or Newly Deprecated Features |
Changed, Enhanced, or Newly Deprecated 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. |
|
|
|
- The 'referencedType' of a 'model.StructuralFeature' can now be any |
|
'binding.IComponentKey', not just a type or a string. Types are also now |
|
implicitly component keys, which means you can use 'binding.Obtain(SomeType)' |
|
to look up 'SomeType'. (Right now, this is no different than using 'SomeType' |
|
without the 'binding.Obtain()', but in future releases this will use a |
|
"class replacement service" to allow easy replacement of model and other |
|
collaborator classes, while implementing AOP-like features.) |
|
|
|
- Added 'naming.Indirect(key)', a 'binding.IComponentKey' that can be used to |
|
do an indirect lookup via another 'IComponentKey' (such as a name). |
|
|
|
Using 'naming.Indirect()', you can replace code like this:: |
|
|
|
socket = binding.Obtain( |
|
lambda self: self.lookupComponent(self.socketURL), |
|
adaptTo=[IListeningSocket] |
|
) |
|
|
|
with code like this:: |
|
|
|
socket = binding.Obtain( |
|
naming.Indirect('socketURL'), adaptTo=[IListeningSocket] |
|
) |
|
|
|
- Added 'peak.running.supervisor', a mini-framework for pre-forking, |
|
multiprocess servers, such as for FastCGI. The framework includes a ZConfig |
|
schema for process supervisors, and support for automatically forking new |
|
children (up to a predefined maximum, with a minimum interval between |
|
launches) when a socket has pending connections and all of its child |
|
processes are busy. With this setup, you can take more advantage of |
|
multiprocessor machines for CPU-intensive services. |
|
|
|
- Standardized these characteristics of name and address syntax: |
|
|
|
* '//' at the beginning of URL bodies is *mandatory* when the URL begins |
|
with an "authority" as described by RFC 2396. When the URL is not |
|
required to contain an authority (e.g. 'peak.storage.SQL.GenericSQL_URL'), |
|
the '//' is *optional*, and the canonical form of the URL will not include |
|
it. |
|
|
|
* Standardized names for RFC 2396 fields: 'user', 'passwd', 'host', and |
|
'port'. |
|
|
|
- Added 'peak.metamodels.ASDL', a metamodel for the Zephyr Abstract Syntax |
|
Description Language. ASDL is a convenient way to describe a domain model |
|
for an abstract syntax tree (AST), and the models generated with the new |
|
ASDL tool can be combined with concrete syntax to create a complete parsing |
|
solution for "mini languages", possibly including the Python language |
|
itself. (Future versions of the Python and Jython compilers are likely to |
|
use AST models based on ASDL, and in the current Python CVS sandbox there's |
|
already an ASDL model of Python's AST available.) |
|
|
|
- Enhanced 'fmtparse' and 'peak.model' to allow using types as syntax rules |
|
for parsing, including abstract types. An abstract type's syntax is the |
|
union (using 'fmtparse.Alternatives') of the syntaxes of its subclasses |
|
(as specified by 'mdl_subclassNames'). |
|
|
|
- Added 'IMainLoop.setExitCode()' and 'IMainLoop.childForked()' methods, to |
|
allow reactor-driven components to control the mainloop's exit code. |
|
|
|
- DEPRECATED 'peak.util.signal_stack'. Instead, bind to a |
|
'running.ISignalManager' and use its 'addHandler()/removeHandler()' methods. |
|
This has the same effect as 'pushSignals()' and 'popSignals()', except that |
|
you do not have to remove handlers in the same order as you add them, and |
|
*all* active handlers are invoked for a given signal that they handle. |
|
|
|
- Added 'IBasicReactor.crash()', which forces an immediate reactor loop exit, |
|
ignoring pending scheduled calls. |
|
|
- Added 'peak.running.commands.runMain()', a convenience function for starting |
- Added 'peak.running.commands.runMain()', a convenience function for starting |
an application's "main" command, that also makes it easy for forked child |
an application's "main" command, that also makes it easy for forked child |
processes to exit and replace the parent process' "main". The 'peak' script |
processes to exit and replace the parent process' "main". The 'peak' script |
|
|
'Constant(value)' -- use 'Make(lambda: value)' |
'Constant(value)' -- use 'Make(lambda: value)' |
|
|
'Acquire(key)' -- use 'Obtain(key, offerAs=[key])' |
'Acquire(key)' -- use 'Obtain(key, offerAs=[key,])' |
|
|
'Copy(value)' -- use 'Make(lambda: <expr to copy value>)' |
'Copy(value)' -- use 'Make(lambda: <expr to copy value>)' |
|
|
means you should change 'return foo, None' statements to just 'return foo'. |
means you should change 'return foo, None' statements to just 'return foo'. |
|
|
- Property definition rules in an .ini file can now refer to 'rulePrefix' and |
- Property definition rules in an .ini file can now refer to 'rulePrefix' and |
'ruleSuffix' variables. 'rulePrefix' is a '.'-terminated string, |
'ruleSuffix' variables. 'rulePrefix' is a "."-terminated string, |
representing the name the rule was defined with. For example, if the |
representing the name the rule was defined with. For example, if the |
rule was defined for '"foo.bar.*"', then 'rulePrefix' will be '"foo.bar."'. |
rule was defined for '"foo.bar.*"', then 'rulePrefix' will be '"foo.bar."' |
|
|
The 'ruleSuffix' will be the portion of the 'propertyName' that follows |
The 'ruleSuffix' will be the portion of the 'propertyName' that follows |
'rulePrefix'. So, if looking up property '"foo.bar.baz"', then the |
'rulePrefix'. So, if looking up property '"foo.bar.baz"', then the |
'"foo.bar.*"' rule will execute with a 'ruleSuffix' of '"baz"'. This should |
'"foo.bar.*"' rule will execute with a 'ruleSuffix' of '"baz"'. This should |
|
|
Corrected Problems |
Corrected Problems |
|
|
|
- 'peak.running.commands.CGICommand' could become confused on certain BSD |
|
variants (such as Mac OS/X), and assume it was running under FastCGI, even |
|
if it wasn't. (Because the operating systems in question use socket pairs |
|
to implement pipes.) |
|
|
- Fixed some problems with the test suite when running under Python 2.3. |
- Fixed some problems with the test suite when running under Python 2.3. |
PEAK itself worked fine, but the test suite was bitten by two minor |
PEAK itself worked fine, but the test suite was bitten by two minor |
semantic changes that took effect in 2.3, resulting in lots of error |
semantic changes that took effect in 2.3, resulting in lots of error |