|
|
Changed, Enhanced, or Newly Deprecated Features |
Changed, Enhanced, or Newly Deprecated Features |
|
|
|
- Added 'binding.Require', 'binding.Obtain', 'binding.Make', and |
|
'binding.Delegate'. *ALL* other binding types are now DEPRECATED, and will |
|
go away before 0.5 beta is released: |
|
|
|
'requireBinding("info")' -- use 'Require("info")' |
|
|
|
'delegateTo("attr")' -- use 'Delegate("attr")' |
|
|
|
'New(type)' -- use 'Make(type)' |
|
|
|
'New("module.type")' -- use 'Make("module.type")' |
|
|
|
'bindTo(key)' -- use 'Obtain(key)' |
|
|
|
'Constant(value)' -- use 'Make(lambda: value)' |
|
|
|
'Acquire(key)' -- use 'Obtain(key, offerAs=[key])' |
|
|
|
'Copy(value)' -- use 'Make(lambda: <expr to copy value>)' |
|
|
|
'whenAssembled(func)' -- use 'Make(func, uponAssembly=True)' |
|
|
|
'bindSequence(key1,key2,...)' -- use 'Obtain([key1,key,...])' |
|
|
|
'bindToProperty(x,y)' -- use 'Obtain(PropertyName(x),default=y)' |
|
|
|
'bindToParent()' -- use 'Obtain("..")' |
|
|
|
'bindToSelf()' -- use 'Obtain(".")' |
|
|
|
'bindToUtilities()' -- no replacement; let me know if you're using this. |
|
|
|
Note that 'Make' and 'Obtain' also support sequences of recipes and keys, |
|
and in those cases will produce a sequence of the results from those recipes |
|
or keys. Also, 'Make' will accept no-argument and one-argument callables, |
|
where 'Once' always required three-argument functions. This should make it |
|
a lot easier to write short binding functions. |
|
|
|
Also, note that the 'activateUponAssembly' keyword is now 'uponAssembly', |
|
and 'isVolatile' is now 'noCache'. (The old names will work as keyword |
|
arguments until the alpha 4 development cycle begins.) The |
|
'binding.IActiveDescriptor' interface also changed as a result of this. |
|
Last, but not least, a 'binding.IRecipe' interface was added, to support the |
|
new 'binding.Make' type. |
|
|
|
|
|
- Added a 'lockName' attribute to 'runnning.AdaptiveTask', and a 'LockURL' |
|
setting to its ZConfig schema. This allows a lockfile URL to be specified |
|
for adaptive tasks that need exclusive access to some resource while |
|
running. |
|
|
|
- A list or tuple of 'IComponentKey' instances is now treated as a single |
|
component key, that returns a tuple of the values returned by each |
|
constituent component key. This means that 'binding.Obtain()' and |
|
'lookupComponent()' can now accept a list or tuple of component keys. This |
|
makes 'bindSequence()' obsolete, so 'bindSequence()' is now DEPRECATED. |
|
'binding.bindSequence(key1,key2,...)' can now be replaced with |
|
'binding.Obtain([key1,key,...])', and will produce the same results. |
|
|
|
- 'naming.IBasicContext.lookup()' and 'naming.lookup()' now accept a 'default' |
|
argument, similar to that used by 'lookupComponent()' and most other |
|
lookup-like APIs in PEAK. This change was made so that component lookups |
|
don't need to rely on catching 'exceptions.NameNotFound' errors to tell them |
|
when to use the default value. This could hide 'NameNotFound' errors that |
|
were actually from a broken component somewhere in the lookup process. (In |
|
general, it's probably a bad idea to have an exception that's used for both |
|
control flow and real errors!) |
|
|
|
- Added new 'version' tool that automatically edits files to update version |
|
information in them. Just execute the 'version' file in the main PEAK |
|
source directory. (Use '--help' for help.) You can use this tool with your |
|
own projects by creating 'version' and 'version.dat' files in your project |
|
directory, similar to the ones used by PEAK. The 'version' file is a ZConfig |
|
file that describes your project's version numbering scheme(s), formats, |
|
and the files that need to be edited, while the 'version.dat' file contains |
|
the current version number values. Source for the tool, including the |
|
configuration file schema, is in the 'peak.running.tools.version' package. |
|
(Error handling and documentation, alas, are still minimal.) |
|
|
|
- Added new 'Alias' command in 'peak.running.commands'. An 'Alias' instance |
|
can be used as a 'peak.running.shortcut' property that expands to another |
|
command with arbitrary arguments inserted before the original command's |
|
arguments. Thus, one might alias 'mycommand' to 'runIni somefile --option', |
|
similar to command aliases in many shells. |
|
|
|
- 'naming.IName' is now derived from 'binding.IComponentKey', so names and |
|
addresses must now support the 'findComponent()' method. All PEAK name and |
|
address types provide support for this. |
|
|
|
- The 'lookup()' method of 'binding.IComponentKey' is now called |
|
'findComponent()', to better distinguish it from 'lookup()' in |
|
'naming.IBasicContext', which does something very different. |
|
|
|
- 'binding.Obtain()' (formerly 'binding.bindTo()' and 'binding.bindSequence()') |
|
now pre-adapt their arguments to 'IComponentKey', to speed lookups at |
|
runtime, and to ensure that errors due to an unusable parameter type occur |
|
at class creation time instead of waiting until lookup time. |
|
|
|
- There's a new 'peak.storage.files' module, with handy classes like |
|
'EditableFile'. 'EditableFile' is a class that lets you edit the contents |
|
of a file "in place", with atomic replacement of the original at transaction |
|
commit. If the transaction is aborted, the original file is left unchanged. |
|
|
|
- 'peak.running.scheduler.UntwistedReactor' now supports a configuration |
|
property ('peak.running.reactor.checkInterval') to determine how long it |
|
should run 'select()' calls for, when there are no scheduled tasks. |
|
|
|
- 'peak.running.scheduler.UntwistedReactor' now supports using a "signal |
|
manager" component (via the 'peak.running.signalManager' property) to |
|
process signals while a 'run()' loop is in progress. Signal managers can |
|
also be added or removed at any time via the new 'peak.util.signal_stack' |
|
module. |
|
|
|
- 'peak.running.commands.AbstractCommand' now offers a '_run()' method that |
|
can be overridden in subclasses, instead of 'run()'. If you override the |
|
new '_run()' method instead, you get the advantage of automatic handling |
|
for invocation errors and 'SystemExit' exceptions, provided for you by the |
|
'run()' method. |
|
|
|
- There is now a 'storage.DMFor(class)' function that returns a configuration |
|
key for registering or looking up data managers by class. You can use the |
|
returned key in a binding's 'offerAs' list, or as the target of a 'bindTo()' |
|
or 'lookupComponent()'. The key is constructed using |
|
'config.ProviderOf(storage.IDataManager,class)'. |
|
|
|
- You can now register utilities that are keyed by the combination of an |
|
interface and one or more classes, using 'config.ProviderOf(iface,*classes)' |
|
as a configuration key. Providers are registered under an '(iface,klass)' |
|
tuple for each specified class, and looked up using the MRO order of the |
|
class specified for lookup. In other words, searching for a provider will |
|
find a provider for the requested class, or one of its base classes, with |
|
precedence given to the more-specific provider. This is primarily intended |
|
for services like data managers and Specialists. |
|
|
|
- It's now possible to extend .ini file parsing with custom section types, |
|
and PEAK defines its own built-in section types using this extension |
|
mechanism. Custom section types must include at least one space, (e.g. |
|
'[My Section]') or they will be treated as a plain property name. |
|
See the 'peak.config.iniFile.sectionParsers' section in 'peak.ini' for |
|
more details, along with the 'config.ISettingParser' and 'config.IIniParser' |
|
interfaces. |
|
|
|
- When creating a 'PropertyName()', it's now possible to force conversion of |
|
invalid characters to '_', using the 'PropertyName.fromString()' |
|
constructor. (Note that the input must be a plain-ASCII string.) Unless |
|
you request that wildcards ('?' and '*') be kept, they will also be |
|
converted to '_' characters. This can be convenient for converting things |
|
like filenames or text that might contain spaces, to property names. |
|
|
|
- It's now possible to declare an attribute as offering a wildcard property; |
|
such lookups now follow the same rules as other wildcard property lookups. |
|
The 'config.IConfigKey' interface has been changed to cleanly support |
|
implied keys at both registration and lookup time, so you can implement |
|
your own key types that work the way interfaces or property names do for |
|
configuration lookups. |
|
|
|
- The 'EigenRegistry' class has been moved from 'peak.util.EigenData' to |
|
'peak.config.registries', as it hasn't really been useful outside PEAK for |
|
a while now. |
|
|
- .ini files now support "smart property" objects ('config.ISmartProperty'). |
- .ini files now support "smart property" objects ('config.ISmartProperty'). |
If a property rule defined in an .ini file evaluates at runtime to an object |
If a property rule defined in an .ini file evaluates at runtime to an object |
that implements 'ISmartProperty', the object will be given a chance to |
that implements 'ISmartProperty', the object will be given a chance to |
|
|
Corrected Problems |
Corrected Problems |
|
|
|
- Transaction participants that raised an error in their 'abortTransaction()' |
|
method, would not receive a 'finishTransaction()' call, the error was |
|
passed through to the transaction service's caller, and later participants |
|
might not have received an 'abortTransaction()' message either. |
|
|
|
- SQL connections didn't close their cursors before aborting a transaction |
|
|
|
- The logging system would raise an error if a log message with no arguments |
|
contained a '%' sign. |
|
|
- There was a typo in peak.naming.arithmetic that caused homogeneous non-URL |
- There was a typo in peak.naming.arithmetic that caused homogeneous non-URL |
name subtraction to fail. |
name subtraction to fail. |
|
|