[Subversion] / PEAK / src / peak / exceptions.py |
No default branch
Bookmark a link to HEAD:
(view)
(download)
(as text)
Speed startup/reduce footprint of programs not using module inheritance, by not loading those modules unless needed. This cuts the total modules needed to run a PEAK application by 4.
Remove items that were deprecated during alpha 3 development. If you've got code that breaks with this version, check HISTORY.txt for replacements, or ask on the mailing list.
MAJOR API REFACTORING for 'peak.config', to support iterating over configuration keys, 'n2' navigability of properties, and much more. Many APIs are now DEPRECATED or renamed; please see CHANGES.txt for a complete description. A few highlights: - 'config.lookup()' replaces 'findUtility' and 'getProperty' - 'config.iterValues()' replaces 'findUtilities' - 'config.iterKeys()' finds keys in a specific namespace - NEW: 'config.parentProviding()' and 'config.parentsProviding()' APIs to find parent components that support a protocol. - NEW: You can now use 'peak n2 config:' to explore the default property namespace. For example 'ls -l peak.naming.schemes' will list all defined naming schemes. Please see CHANGES.txt for the list of deprecated or removed APIs.
Plan-it of the APES, phase 1. Configuration APIs now require an explicit context argument. There is a 'config.IConfigurationRoot' interface, that is currently implemented by AppConfig and SystemConfig. There is also a 'NullConfigRoot' object that implements it by giving "invalid root" errors. Right now, however, you'll never see that message because 'iterParents' still goes to the special config objects once a root is reached. That'll be changed in the next phase.
First draft implementation of system scheduling proposal. (Also, misc. TODO additions.) Interfaces have been streamlined and names changed. Daemons are now "periodic tasks", and the provided base class implements an "adaptive task" interface. "Daemonic app", "event loop", and "daemon scheduler" are now just a single "system scheduler" interface, which can schedule periodic tasks as well as one-offs. I settled on "higher priority number" = "higher priority" for priority sorting. I'm beginning to like this whole "asynchronous programming" model that Twisted provides. AdaptiveTask (formerly BaseDaemon) is a lot simpler, MultiDaemon went away, and the system scheduler is only two screens of code to manage idle timeouts, prioritized task scheduling, and more. Heck, "shutdown after X" was as simple as 'callLater(duration,self.stop)'! There is one minor problem in this draft... if a task raises an unhandled exception, it won't be scheduled for further re-run. I'm not sure if this is a bug or feature yet. It should be easy to fix, though.
Major refactoring of 'peak.model'. Changes include: * Added 'enumerations' module with the new implementation of 'model.Enumeration' -- read its (thorough) docs for details on the new features. Changed existing uses/test cases for the new "spelling" of enumerations. * The 'interfaces' module has been thoroughly revised to drop ancient TransWarp stuff, and to mostly match the actual structure of today's 'peak.model' package. It still needs to be gone over for errors and omissions, and the docs need to be fleshed out some more, but it should actually provide some useful information now. * Features now support an 'implAttr' attribute which can specify what attribute is actually used to store the feature. It defaults to being the same as the feature's name, but you can override it in the feature definition to redirect its storage to a private attribute. * There is now a 'structField' feature type that can be used to define read-only fields for immutable types without having to keep typing 'isChangeable = False'. * Features now won't actually allow themselves to be changed, if their 'isChangeable' flag is false. * Many methods have moved around, in an attempt to consolidate the class hierarchy for features. This process may continue for a bit. This check-in completes about 60-80% of the 'peak.model' refactoring that I announced on the mailing list. It has now progressed far enough that I can begin experimenting with the MOF and XMI features that were blocked waiting for this work. Implementing those features may drive further changes to the 'peak.model' package, but I believe the API of 'peak.model' is no longer dangerously unstable. (One known change that's still to come: default constructor implementations for 'model.Immutable' and 'model.Element'.) Prior to this refactoring, it was unclear what paradigms would come out on top in certain areas, and that uncertainty is now mostly eliminated. It's most likely that further refactorings in 'peak.model' will be mere "spelling" or class hierarchy implementation issues, rather than fundamental changes of approach. But I'm going to wait until XMI writing and MOF->Python code generation are further along before declaring the API "stable" on the general mailing list.
Fixed formatting of naming exceptions, so that they display as I originally intended. That is, with lots of useful debugging information included.
Re-org/refactoring of many items from the TODO list for 0.5, including: * moved peak.binding.imports -> peak.util.imports, added importSuite() * Decided not to do binding.Acquire, it should just be a documented idiom * Moved LDAP and lockfile URLs to peak.storage.LDAP and peak.running.lockfiles, respectively * Moved factories.getObjectInstance -> spi, updated peak.ini to load naming.spi as the provider. * Consolidated naming.references into naming.names * Made ParsedURLs compile their pattern strings, and automatically make their 'fromX()' methods classmethods (and the same is true for other 'struct' types. * Refactored cursors and connections out into distinct SQLCursor/LDAPCursor types, based on a common AbstractCursor. * Added TooManyResults/TooFewResults errors to peak.exceptions
Moved all PEAK API exceptions to 'peak.exceptions' module, because it was getting pretty darn inconvenient to keep importing them across subpackages. 'from peak.api import exceptions' or 'from peak import exceptions' can be used to access them. It's worth the trouble of referring to 'exceptions.SomeException', because it allows the names to be shorter (no need for Exception or Error in the name) and makes the exceptions globally available. Added 'binding.iterParents()', which walks from a component up through its root parent, into the local and global configuration objects, if available. It's now used in getProperty() and findUtilities(). Synchronized interface of 'binding.findUtility()' and 'config.getProperty()'. Now both take an optional 'default' argument which will be returned if the sought item is not found, or, if a default is not supplied and the item isn't found, an 'exceptions.NameNotFound' error is raised. (findUtility() used to return 'None' to mean not-found). Fixed a bug in 'binding.lookupComponent()' for looking up utilities (which also caused 'bindTo(ISomething)' to not work correctly). Added a 'config.Property' class, a subclass of 'str', which parses and validates property names, as well as handling wildcard iteration. It also implements enough of 'IInterface' to allow it to be used as a key in an EigenRegistry. There's a new interface 'config.IConfigKey', which is implemented by both Interface objects and Property objects, so everything that can be used as a configuration key now implements it. This is another step towards unification of configuration properties (keyed by name) and utilities (keyed by Interface). After a few more passes, I should be able to eliminate the rest of the parallel logic that exists to process both Utilities and Properties. Fixed a typo in 'storage.TransactionComponent' which would have caused it to raise an error upon joining a transaction.
cvs-admin@eby-sarna.com Powered by ViewCVS 1.0-dev |
ViewCVS and CVS Help |