[Subversion] / PEAK / src / peak / peak.ini |
No default branch
Bookmark a link to HEAD:
(view)
(download)
Missing typemap for pymysql. (We really should clean up the way type mapping is done for SQL connections, so you don't need a default namespace just to get paramstyle stuff working.)
Basic MySQL support (PyMySQL and MySQLdb)
Fix type mapping setup for adodbapi SQL driver
Added "paramstyle" support for SQL connections, so you can write backend-agnostic SQL with parameters. See CHANGES.txt for usage details.
Add support for adodbapi (http://adodbapi.sf.net/ ), and switch both it and mxodbc to use 'ref:dbtype@dsn:DSNSTRING' URLs.
Added experimental support for mxODBC (Windows only)
Get rid of remaining 'config.fileNearModule()' uses; thanks to Yaroslav Samchuk for pointing out their existence.
Remove all vestigial traces of the old 'Interaction' interface/object from peak.web. Clean up miscellaneous cruft such as 'CGIPublisher' (now 'WSGIPublisher') and make your choice of interaction policy configurable, which is especially important now that the interaction policy controls all the security rules. The 'user' of a traversal context is now a first-class part of the traversal context, rather than hanging off of the now-useless 'interaction' attribute.
The old 'peak.security' implementation has been removed, and replaced with a simpler, more flexible implementation based on generic functions (using less than half the code and seven fewer interfaces). Complete docs and API tests for the new implementation can be found in 'rules.txt' in the 'peak.security' package directory. (Note: as a side-effect of this change, the old 'security.IInteraction' interface and 'security.Interaction' class can now be temporarily found as 'web.IInteraction' and 'web.Interaction' respectively. Both will soon be refactored out of existence, however, so please update your code accordingly!) Also, the new implemetation does not require redundant 'security.allow(security.Anybody)' declarations just because you've declared other permissions for a class, so these declarations have been removed from ``peak.web``. They don't do any harm, however, so you can leave them in your own code as long as you change them to use 'binding.metadata()' instead of the deprecated 'security.allow()'.
Get rid of the whole imported/exported variables nonsense in n2-sql. Now all variables are in the python interactor's namespace, just like in the n2-ns interactor. However, you can set defaults as properties in the 'peak.n2' namespace. The variable for the n2-sql prompt has been changed from 'prompt' to 'sql.prompt'
Major functionality upgrades for peak.web: * Added 'sitemap' reference type, to allow launching an application with 'ref:sitemap@file:/wherever.xml' * Added parameter validation for DOMlets, including single vs. multi-value parameters * Fix a problem with '++id++' lookups generating an error with an invalid context if the lookup failed * Expanded IDOMletState interface to allow for variables such as 'params', and to allow decorating traversal context with those variables * Fix items found in Location containers from having their '..' reference the container, instead of the Location * Added integration tests to run a simple "site" with a sitemap, views, templates, and so on. * Added '<location configure="iniURL">' * Allow ':replace' and ':xml' DOMlets to invoke views implemented as DOMlets, and pass parameters to them
Very early sketch of sitemap parsing. So far, it only creates location trees, and absolutely nothing else.
Make skin name lookup function into a property, so apps can define custom rules for selecting the default skin.
Refactor 'peak.web.templates' to use the negotiating XML parser. This is a first step towards "PWT Reloaded", although this refactoring doesn't add any new functionality, and shouldn't have changed the old functionality.
Added a 'data:' URL scheme, implementing RFC 2397 (although it's not as strict in its parsing of the content type and parameters as the RFC calls for). This is a semi-convenient way to provide configuration data in-line, since a 'data:' URL can be a 'config.IStreamSource'.
Added 'config.XMLKey()', an 'IConfigKey' type that can be used to register configuration values for XML attribute and element names under specified XML namespace URI's. Also, there are now '[XML Attributes for nsuri]' and '[XML Elements for nsuri]' section types available for use in .ini files. (Replace 'nsuri' with the appropriate XML namespace URI, or use '*' for a wildcard.)
Add an "insert.*" cursor format. "insert.foo" Generates INSERT statments into the table "foo". Silly example: 1> select 1 as one, 2 as two 2> go -m insert.foo INSERT INTO foo (one, two) VALUES (1, 2) go XXX not tested with dates. Most of these probably don't handle them right.
Add '++id++' namespace to allow lookups by "location id". Remove 'findLocation()' method from 'ITraversalContext', since it's redundant to the namespace and direct traversal fnction. (You'd think I'd have learned this pattern by now, but oh well.)
Added a new class, 'config.IniLoader', that can be used to lazily load .ini files as configuration. 'IniLoader' instances have an 'iniFiles' attribute that lists the configuration sources (filenames/URLs/factories) to be used, and automatically load the .ini files as soon as you try to get any configuration data for them. Previously, similar functionality was only available via 'config.makeRoot()'. Also, there's now an 'ini' reference type that instantiates an 'IniLoader' for one or more addresses. Please see CHANGES.txt for usage examples of both new features.
Port all of PEAK's internal and example apps from IRerunnableCGI to IWSGIApplication, and add a new 'WSGI' command wrapper that lets you run non-PEAK WSGI applications in PEAK's containers. For the time being, we're keeping IRerunnableCGI around, however, because it's a more natural interface for the CGI/FastCGI containers to use. See CHANGES.txt for more details on these issues. Also, fixed an issue with templates outputting Unicode instead of ASCII (which is all they really support at the moment.)
Initial, undocumented draft of a new "negotiating parser" for SOX, that allows dynamic communication between XML elements and attributes, so that we can parse sophisticated attribute-based languages like "PWT Reloaded", or even ZPT. The implementation is exhaustively tested, but the true test will be when we hook it up to peak.config to do its lookups, in order to implement ideas like these: http://www.eby-sarna.com/pipermail/peak/2004-June/001478.html http://www.eby-sarna.com/pipermail/peak/2004-August/001713.html
Added Zope 3-like "namespaces" to 'peak.web'. Path segments in a URL may be prefixed with '"++some_id++"' in order to invoke a corresponding namespace handler registered under '"peak.web.namespaces.some_id". Namespace handlers must implement 'web.INamespaceHandler', and they are supplied with the original path segment as well as the separated namespace and name. Also, as in Zope 3, '"@@foo"' is a shortcut for '"++view++foo"'. Builtin namespaces at this time include 'view', 'item', 'attr', 'skin', and 'resources'. 'skin' treats the rest of its path segment as a skin name, and sets the current skin, and 'resources' begins traversal to resources found in the current skin. The other namespaces are as described at: http://www.eby-sarna.com/pipermail/peak/2004-August/001712.html Note, however, that this doesn't include the change to default traversal described there, and there are a couple of other issues outstanding, like defining permissions for views, and fixing legacy uses of "@@" in the peak.web source. We also don't have any registration mechanisms for easy view declarations, or for setting up local "sites" or "sub-applications". Also, this refactoring may break existing uses of 'web.traverseAttr', which now has a completely different meaning and signature.
Namespace traversal for peak.web, Milestone 1: ++resources++ is now a configurable namespace, rather than a funky wrapper mechanism in skins.
Consolidated 'web.ISkinService' and 'web.ILayerService' were into 'web.IInteractionPolicy', because the need to have configurable implementations of these services is negligible. That is, the corresponding property namespaces ('peak.web.skins' and 'peak.web.layers') are more than adequate as registries. (Also, fixed some web-app problems caused by PyProtocols refactoring to use only one-argument adapter factories.)
Massive refactoring of 'peak.web' to remove all Zope dependencies. See 'CHANGES.txt' for details. Note that this is only the beginning of the refactoring, so please promptly report any problems you may find! That way, I hopefully won't get too far ahead, building on anything that might be broken.
Add 'ddt.cgi' shortcut to make it easier to set up server-side DDT.
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.
Added 'ref:factory@addr' URL scheme that maps to a corresponding 'naming.Reference("factory",["addr"])'. 'factory' can be either a dotted import string referencing a 'naming.IObjectFactory', or you can define a factory in the 'peak.naming.factories' property space. Added a 'zconfig.schema' factory, so that 'ref:zconfig.schema@streamURL' will load a schema loader. See CHANGES.txt for more details on all the cool stuff you can do with this.
Added 'ddt.FunctionChecker', which can test any callable that takes keyword arguments only, assuming you don't want to test that errors are raised. (Although that capability could perhaps be added later.) Also added an 'ItemCell' cell mapper for mapping cells to dictionary items. This mapper is used by 'FunctionChecker' to map cell values to a dictionary of keyword arguments. Last, but not least, changed the 'methodTypes' keyword of various checkers to be 'typeInfo', since it is used now for lots of things that have nothing to do with methods.
Changes to make the n2 \htmldump + ddt.SQLChecker combo work better on real data. Specifically, use 'repr()/eval()' instead of 'str()'.
Fix typos, and add 'ddt.RollbackProcessor' to wrap tests in a transaction.
Renamed old 'ddt.web' to 'ddt.view', and added new 'ddt.web' that publishes a directory of test documents. So, using:: peak ddt.web src/peak/ddt/tests would display a list of test documents in your browser, letting you click on the documents to run the tests and display the results.
When running a local web server, let the TCP/IP stack tell us what port to use by default.
Added properties to the command-line applications framework, allowing non-command objects access to 'stdin', 'stdout', 'argv' etc. from their context. Also, misc. subcommand usage cleanups.
Minor fixes for Twisted, such that 'peak launch' can run in Twisted. (That is, it's verified now that readers using 'peak.events' can work with a Twisted reactor.)
Fix broken docs and implementation of '[Named Services]'. The idea was for the expression to *be* the factory, not *designate* the factory.
Added '[Named Services]' section parser to 'peak.ini'. This new section type functions almost identically to '[Component Factories]', except that the keys are property names rather than references to interfaces or other component keys. This should be helpful for configuring shared services that all implement the same interface, such as SQL connection objects. Note that to look up a named service, you simply use the appropriate property name, as usual. The difference is that you are guaranteed to always use the same *instance* of the service, within a given service area. Also, added 'ddt.SQLChecker()', which verifies SQL results against a test document. 'SQLChecker' makes use of the new "Named Services" feature in order to ensure it's accessing the database you intend to test (as opposed to say, the nearest SQL connection object).
Rename processors to MethodChecker, ModelChecker, ActionChecker, and RecordChecker, to better reflect their intent. Refactored RecordChecker to use objects as data rows instead of using value sequences, and added 'format()' method to 'ICellMapper' interface.
Added rough draft of 'RowProcessor'. Expanded 'ICellMapper' interface to cover new needs, and refactored mapper implementations to inherit from a common base for most of their methods. Added 'Score.__nonzero__' method, so that you can use 'if cell.score:' to tell whether a cell has already been marked.
Got 'ddt.ActionProcessor' working, with example/test.
Major upgrades to DDT package: * Added 'ICellMapper' interface to allow introspective actions on objects, with adapters predefined for methods, properties, and 'model.IFeature' objects. * Added 'MethodProcessor' and 'ModelProcessor' (test), and 'ActionProcessor' (not yet tested) * Lots and lots of docstrings added * The 'HTMLDocument' DM now always strips leading/trailing whitespace from cell text. * New functions 'ddt.titleAsMethodName()' and 'ddt.titleAsPropertyName()' for standardized parsing of certain types of cell data. * Updated demo classes to use both 'MethodProcessor' and 'ModelProcessor' * Fixed 'Cell.assertEqual()' to normalize its input value to the same type that it's interpreting the cell as. This effectively allows the fallthru comparison case to be 'str(value)==cell.text', when the "official" type for the cell is unknown. * Fix 'ddt.web' runner to work properly when serving a single file as the root. (We probably also need some way for this to support a convenient run-once-and-exit strategy.)
Added 'ddt.web' command that runs DDT test documents in a browser. Try it with:: peak ddt.web http://fit.c2.com/files/HtmlSamples/Documents and try running some tests. This is still very crude; note that it doesn't handle non-HTML documents well, and can't do its own directory indexes when you use a local URL as the base. It also lacks any error trapping, so you have to keep an eye on the console you've run it from in order to find out what's happening. Nonetheless, it works pretty decently for such a rough draft.
Added 'peak serve' and 'peak launch' commands, for running "CGI" apps in a browser from the local machine. For example, doing this:: PYTHONPATH=examples/trivial_cgi peak launch import:the_cgi.DemoCGI from the base directory of a PEAK CVS checkout or source distribution will launch the 'trivial_cgi' demo program in a new or current browser window. Any application runnable with 'peak CGI' should also be runnable with 'peak serve' or 'peak launch', which makes it very useful for running local browser-based apps or testing an application without CGI or FastCGI available. The modules that support this new functionality are 'peak.util.WSGIServer' (which implements a web server based on Python's 'BaseHTTPServer', that can run 'running.IRerunnableCGI' objects) and 'peak.tools.local_server' (which provides PEAK integration.)
Misc. fixes such that DDT can process most word proc. and spreadsheet formats found at http://fit.c2.com/files/HtmlSamples/Documents/ Mostly, this consists of whitespace-stripping, and a fix for unclosed <td> and <tr> tags.
DDT has landed! See CHANGES.txt and peak.ddt.demos for more info.
Add a "html" format, a'la sqsh. Perhaps extra-useful in PEAK for use with DDT for database-oriented tests: select data for tests straight into a format that requires no or minimal editing for use with DDT.
Big migration to 'peak.events': 'UntwistedReactor' and 'MainLoop' are now just facades over 'EventLoop'. Added untested Twisted support to implement 'peak.events' interfaces as facades over a reactor. Minor interface tweaks in 'peak.events' to cover the needs of real (and testable) event loops. Moved 'ifTwisted' and 'makeTwisted' to 'peak.events.api'. Ported 'TaskQueue' and 'FastCGIAcceptor' to use threads for scheduling. Por Other: fixed 'commands.AbstractInterpreter' failing with usage errors at construction time, rather than at use time. Refactored 'CGIInterpreter' to be an actual interpreter, and 'CGICommand' to not run an event loop unless FastCGI is being used. Also changed 'CGICommand' to perform setup at _run time rather than immediately upon assembly.
Added draft 'ISelector' implementation, and refactored 'UntwistedReactor' to use it for I/O events.
Lots of 'peak.events' migration: Added 'events.ISignalSource', that returns 'events.Broadcaster' objects for signals. This allows you to yield to signals in an 'events.Thread', or safely set one-time callbacks on them. 'running.ISignalManager' is now DEPRECATED; please use 'events.ISignalSource' instead. 'running.IMainLoop' has been changed to use an 'events.IReadable' for the 'lastActivity' attribute, and the 'setExitCode' and 'childForked' methods have been replaced with an 'exitWith()' method. The 'peak.running.mainLoop.signalHandler' property has been replaced with 'peak.running.mainLoop.stopOnSignals', which defaults to including SIGINT, SIGTERM, and SIGBREAK. If you need custom signal handling, please use the event sources provided by an 'events.ISignalSource'. 'peak.running.process.ChildProcess' has been rewritten to use 'events.ISignalSource' and an 'events.Thread' to monitor SIGCHLD. Removed 'checkStatus()' from the 'running.IProcessProxy' interface. Made most event sources weak-referenceable. Changed 'events.Thread' to keep a reference to an object it's yielding on, so that "weak" events like signals and I/O events will hang around until they call back to the thread.
Fix 'setup.py' not installing 'csv.py'.
"csv" and "csv.<dialect_name>" cursor formaters using csv module. Issues: - end-of-line character handling. Right now n2 output redirection always gets you text mode. force csv line terminator to "\n" so you get local newlines for now. But what about binary output formats? Do we need some kind of binary-mode redirection operators? - dialect defaults for delimiter, etc are not overrideable by n2's go command line options. (problem? should "go -m csv -d "\t" work the same as "go -m csv.excel-tab"?) - csv.py not installed by setup.py? (haven't looked into it yet)
Add a cursor format called "copy", compatible with the COPY FROM command in postgres and sqlite. Also fix n2 to not override defaults of the cursor formats when no flags are specified.
Whitespace normalization.
Simplified configuration for using Twisted, roughly as proposed in http://www.eby-sarna.com/pipermail/peak/2004-January/001125.html Also, added 'iif' function for use in .ini files.
'peak.events' has landed, complete with docstrings and full unit tests.
First pass of 'logs' framework refactoring. Highlights include: * Lots of new unit tests for logging. * Logs are now accessed via a 'logs.ILoggingService' instance. The 'logger:' URL scheme automatically accesses the nearest such service. For backward compatibility, the old 'peak.logs' namespace is still used to supply the actual loggers. This will be gradually replaced with a plugin-based mechanism. * Log events don't use a positional 'message' argument any more, and loggers aren't responsible for interpolating message arguments any more. The new signature is 'Event(parent, msg=msg, args=args, ...)'. Loggers also now tell events what logger name they are, via the 'ident' keyword. * The logging system now uses a property namespace, 'peak.logging.levels', to obtain log level names and values. The various 'logs.LEVEL' constants are now DEPRECATED. Please use the 'getLevelFor()' method of the nearest 'logs.ILoggingService' instead. URL schemes such as 'logfile:' also no longer convert their level names to numbers, since the level names are only meaningful in the context of a logging service. * Support for integration with the Python 2.3/PEP 282 logging module has been scaled back. There are too many globalisms and dependencies there. When we add plugin-based log configuration, it should be possible to use the logging package's handlers and formatters with the PEAK logging services. At that point, you'll be able to replace 'logging.getLogger' and 'logging.getLevelName' with the corresponding methods of a PEAK logging service, if you need to force non-PEAK packages to use PEAK's logging. * 'config.Namespace()' objects now have a 'keys()' method that can be used when the namespace is bound to a context component. It returns a list of strings that may be used as keys for that namespace. See 'CHANGES.txt' for an example.
Fix win32 using 'time' instead of 'clock' for elapsed time.
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.
PEAK changes: - rename "python" cursor formatter to "repr" - make "sql" and "ldap" formatters equivalent to "horiz" and "ldif" respectively, and use them as the default for SQL and LDAP cursors. This allows the default to be changed per cursor type while still leaving horiz and ldif available to things that want them specifically - replaced ICursor.getFormatter() with dumpTo() method. No reason for the client of a cursor to interact with the formatters directly. - TODO: XXX: raise or return error on nonexistant formatter? N2 changes: - update to use dumpTo - "go -x code" to execute code on the cursor instead of using dumpTo - "go -r code" to execute code per row instead of using dumpTo - "go -p" to drop into python with "cursor" bound to the cursor (NOTE: -r, -x, and -p may be combined)
Finished out timer service with wildcard 'addListener()' support, and a 'timer:foo.bar' URL scheme, so you can now 'Obtain("timer:myapp.whatever")' in your applications. Of course, to be really useful, we need some listeners that can log or otherwise output the statistics. And I'm still planning to move the time-critical parts of the Timer class to Pyrex. But the timing framework itself is now complete and ready-to-use.
Extensible cursor formatter support Make the various cursor output formats defined by n2 generally available, and make it possible to configure new ones. It is now possible to call getFormatter(NAME, ...) on a cursor and get an CursorFormatter (factory looked up in peak.cursor.formatters.NAME) that is bound to it. As they are very common, "header", "footer" (both bool), and "delim" are available as keyword properties on all formatters (and may be passed to getFormatter). They may be ignored by some formatters. Other keyword args may be passed if you know the named formatter accepts them, or you can set properties on the formatter that it may bind to. The resulting formatter may be called, passing a file-like object, to format the cursor's data to the file. For example, to export a subtree of LDAP in a LDIF file: ldapcon = root.lookupComponent('ldap://...') curs = ldapcon('o=fooblycorp', ldap.SCOPE_SUBTREE) curs.getFormatter('ldif')(sys.stdout)
Partial implementation of the performance timer system described at: http://www.eby-sarna.com/pipermail/peak/2003-December/001020.html It's missing the 'addListener()' function for the timer service, so you can only add listeners directly to individual timers. The actual interfaces are also a bit different than what was originally proposed. An exhaustive test suite is included, covering all of the implemented behavior. This draft implementation will probably get moved to Pyrex, at least to create a a Timer base class with fast-path execution for frequently called methods. The goal is to have timer invocation be so fast that leaving timers in production code isn't an issue. (TODO: 'addListener()' for keys/wildcards, 'timer:' URL scheme, and Pyrex port of Timer base.)
Significant refactoring of skin/layer/resource/interaction/service classes in 'peak.web'. Primary goal was to allow layers to be shared between skins, but several other things were also accomplished: * Got rid of properties to configure services and factories, using "[Component Factories]" mechanism instead. * Added explicit interfaces for auth/skin/layer/resource services * Interaction and InteractionPolicy implement various services by delegation, so things like 'interaction.skin.getResource()' are now 'interaction.getResource()' and 'policy.skinSvc.getSkin()' is now 'policy.getSkin()', etc. * Cleaned up various "spaghetti bindings" that wandered all over the place. * Added 'IInteractionPolicy.newInteraction()' for cleaner creation of interaction instances. * Added layer service mechanism to allow layers to be reused among skins. Layers are defined in the 'peak.web.layers' property namespace. * Added skin service mechanism that locates skins using 'interaction.skinName' (which defaults to '"default"'). Skins are defined in the 'peak.web.skins' property namespace. * Simplified 'config.CreateViaFactory' to allow factories with no arguments.
Fixed 'text' DOMlet not XML-quoting output. Added 'xml' DOMlet for outputting already-quoted output. Added 'notag', 'text.notag', and 'xml.notag' variants that throw away their opening/closing tags. 'notag' does nothing except throw away the open/close tags, which is useful when 'pwt:define'-ing a block that has multiple elements in it, among other things. With 'text.notag' or 'xml.notag', you can now embed text in other text without needing to keep the "span" in the output.
Added "[Import on Demand]" section type to .ini files, allowing you to define shortcuts for modules that you frequently reference in your configuration. This lets you replace e.g. 'importString("foo.bar.baz:Spam")' with 'foo_baz.Spam' in expressions, by adding something like this:: [Import on Demand] foo_bar = "foo.bar.baz" to your configuration. The defined shortcut is then available for the remainder of that configuration file, and in any .ini files included from the current file. See 'peak.ini' for an example and more info.
Move .ini file processing to its own module.
Logging-related interfaces have been moved into the 'peak.running.logs' module. So, what used to be 'running.ILogger' is now 'logs.ILogger'. Log events now use a standard component construction signature, and the class used for event objects is now configurable as the factory for 'logs.ILogEvent'. (See "Component Factories" in 'peak.ini'.) By popular demand, 'logs.ILogger' (and its default implementation) now includes 'trace()', 'notice()', 'alert()' and 'emergency()' methods that use the corresponding 'syslog' priority levels. 'logs.IBasicLogger' has been added, to reflect the narrower interface provided by PEP 282, and there is an adapter that can extend PEP 282 loggers with the other methods. Finally, added 'logs.ILoggingService' (for future implementation), and updated TODO to reflect short-term project priorities that take precedence over the alpha 3 release for now.
The 'logging.logger:' URL scheme has been simplified to 'logger:'. Please convert your scripts and configuration files, as the longer form will go away in the alpha 4 development cycle. Also, fix 'peak help logs' breaking due to a missing 'mdl_typeCode' on 'naming.CompositeName'.
Renamed 'fd:' URL to 'fd.socket:', simplified its syntax to 'fd.socket:fileno/family/kind/protocol', and changed its attribute names to match the syntax. (The rename is because we may want 'fd.file:' later as well.)
Promote peak.running.supervisor to peak.tools.supervisor.
Add API helper tool, as described in: http://www.eby-sarna.com/pipermail/peak/2003-December/000948.html (This should probably expand later to provide additional kinds of help.)
Give peak.running.tools a promotion... it's now just peak.tools
typos
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.
'icb' URL scheme passes tests now; re-added scheme and tests.
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'. In addition, added test cases for all name/address schemes, or documented why no tests are needed (or possible, in the case of icb). Also, refactor 'fd:' URL scheme to use 'model.Enumeration' types so that the URLs have a canonical form (at least within a given platform), and can be properly formatted as well as parsed. Finally, added more docs to 'fdURL' class.
First pass at a fd: url scheme for file descriptors.
Command-line parsing and ZConfig schema for process supervisor.
First draft of new 'SupervisorProcess' pre-forking process manager. Added 'IProcessTemplate' and a draft implementation thereof, along with a revised version of 'IProcessProxy' and a draft implementation of that. Also added 'IMainLoop.setExitCode()' and 'IMainLoop.childForked()' methods, to allow reactor-driven components to control the mainloop's exit code.
enable tcp/udp/unix/unix.dg urls
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. This required changing some tests, because the precise moment of reactor termination is now different in some scheduling scenarios. Some changes were also made to task scheduling for CGI programs to account for this.
First-draft of a global SignalManager and a ProcessManager facility. SignalManager lets you easily subscribe/unsubscribe objects for signal notifications, and is pretty much done. ProcessManager manages child processes, but still has several dependencies that need implementing.
Added 'peak.util.mockdb', a "mock object" implementation of a DBAPI 2.0 driver module. 'mockdb' connections can be told to 'expect()' queries and 'provide()' data to their callers, and will raise AssertionErrors when they are used in a way that doesn't conform to your supplied expectations. This is intended to be used for unit testing components that depend on a database connection: you can verify that they send the right SQL, and you can provide them with dummy data to use. There is also a 'mockdb:' URL and peak.storage driver, so you can easily use a mock DB connection in place of a real one within a PEAK application, for testing purposes. Note, however, that 'peak.util.mockdb' is a DBAPI 2.0 driver in itself, and thus can also be used to test DBAPI usage outside of PEAK.
Added support for 'psycopg', based on research by John Landahl.
Merged 'Fallback' and 'PropertySet' to create 'config.Namespace'. Removed 'Fallback' and deprecated 'PropertySet'.
Fix problems with SQL typemap defaults. Added code to make DCOracle2 cursor descriptions actually interpretable.
Fixed a couple of type conversion bugs: the namespace redirects to 'peak.sql_types' were broken, and some drivers weren't importing strings designating type converters to be imported.
SQL connection objects now get their type converters from a distinct property namespace for each DBAPI driver. For example a driver using the 'cx_Oracle' module will get its type converters from the 'cx_Oracle.sql_types' property namespace, instead of 'peak.sql_types'. For backward compatibility, these driver-specific namespaces are set up to fall back to 'peak.sql_types' for their defaults. Type converter construction has also been improved, to eliminate conversion overhead completely when no conversions are required for a specific query. Also, SQL connections now offer a method that will create a row conversion function for a given result description and optional postprocessing function. This new method should now be used in place of direct access to the 'typeMap' attribute of connection objects.
Cleverly work around ZConfig limitations by redesigning the 'version' tool's schema. ;)
Preliminary ZConfig schema for 'version' tool, sufficient to parse (but not interpret) PEAK's 'version' configuration. Unfortunately, due to some ZConfig limitations, I may need to reconsider parts of the format. Turns out you can't have keys share an attribute, which really rather sucks. I'm going to have to look into how ZConfig "handlers" work and see if maybe that's a more viable option for these matters.
Introduce peak.net for implementations of network protocols and other general networking-related features that don't really fit into storage, naming, etc. Also, an icb protocol implementation work-in-progress. ICB ("Internet CB") is an ancient chat protocol that's not widely used anymore except in some circles. This is more of an example than something likely to be useful by many people, but I have a use for it. Still needs work, though.
Add basic signal handling to mainloop and reactor. Tweak signal stack handling a bit, so that an UntwistedReactor used outside a MainLoop will act almost exactly like Twisted in the same circumstances. But, when used within a MainLoop, the configured 'peak.running.signalManager' will have full control over signal handling.
'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. Also, fixed reactor needlessly sleeping for the defined check interval, when there are neither scheduled tasks nor I/O handlers. This is important for Windows, where signals (e.g. ^C, BREAK) aren't processed during 'sleep()'. (Of course, this'll also burn CPU in a tight loop, but hey, it's Windows, and you won't have anything important running there, right?)
Fixed some issues that could prevent some EventDriven apps from running properly. The 'shellcmd:' URL scheme was broken by naming system changes this release cycle, and the earlier scheduler bug fix for excessive CPU burn had a logic error in it. (If a task was scheduled for the reactor's idea of "now", and no readers/writers were active, the reactor would sleep for an hour, instead of looping back immediately to run the next scheduled event.
'peak.running.scheduler.MainLoop' 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. Also, fixed scheduler tests using an app object without a config root.
Added 'url.*' family of DOMlets. 'url.foo' causes the tag's 'foo' attribute to be replaced with the absolute URL of the current traversal location. 'url.foo+bar' caused the attribute 'foo:bar' to be replaced. 'url' alone replaces the contents of the tag, and 'url.notag' replaces the entire element with just the URL. (The spelling for these latter behaviors may get tweaked a bit.) Testing this shook a few typos and other bugs out of the woodwork. Also, this gives an example of how to create a DOMlet factory that isn't a class, but a function that decides what class to create.
Refactor IWebTraversable.getAbsoluteURL(interaction) to IWebInteraction.getAbsoluteURL(traversable) and IWebTraversable.localPath. This keeps resources from continually recomputing their (and their parents'!) absolute URLs, and also lets TestInteraction compute an absolute URL without 'zope.publisher' being present.
Added TestInteraction/TestRequest. Fix a few typos and such. It's now possible to traverse to resources, using the system defaults, and get their absolute URLs.
Draft implementation of resource directories. We really need some tests for this stuff, which means creating a TestInteractionPolicy, TestRequest, and some other suchlike classes. We also need files to be renderable, a factory for template files, and a 'bindResource()' operation. But, the basic structure is now in place.
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.
More peak.web skin-related enhancements and fixes: Added 'IPolicyInfo' interface for common aspects of 'IWebInteraction' and 'IInteractionPolicy'. Added 'ISkin' interface for skins. Rearranged policy/interaction/skin definitions to this order: 1) CGIPublisher adapts app to 'IInteractionPolicy' to create policy 2) CGIPublisher gets interaction class from policy to create interactions Enhanced NullSkinService to more thoroughly set up the default skin, and to reuse the same skin across requests. Added 'preTraverse()' call to 'afterTraversal()' method, so that terminal published objects get a chance to check preconditions and raise any alerts, redirects, etc. Drafted implementation of skin traversal, getResource() (non-caching), and getResourceURL().
Many peak.web enhancements and fixes: Added 'resourcePrefix' property/attribute to manage coming /++resources++ support Added 'IWebTraversable.getAbsoluteURL()' method, w/default implementations Rename SimpleTraversable -> Traversable and ComponentAsTraversable -> Decorator Added ability for Decorator subclasses to overlay their own attributes (e.g. web pages) onto their subjects Added experimental 'MultiTraverser' that simultaneously traverses a sequence of other traversables, returning another multi-traverser that contains all the children of the wrapped traversables. Added experimental 'Skin' class that serves as a traversal root, and in future will support access to resources. The NullSkinService now actually instantiates a Skin, and Interaction uses its skin as a traversal root. Changed "default method" traversal to check whether the default method actually exists, so as not to cause spurious "not found" errors in that case. Changed Interaction's page.render() handling so that if the subject of a request doesn't support IWebPage, it's simply returned as-is. This allows simple attribute values (e.g. strings, numbers, dictionaries, etc.) to be rendered as strings. Fixed 'List' DOMlet not informing list items of their parent traversable.
cxOracle support -- cxoracle://user:password@database/ Also not well tested.
DCOracle2 support -- dcoracle2://user:password@database/ Not tested well. XXX workaround for property names containing spaces -- needs better fix
Location terminology changes, also made 'interaction.callObject()' suggest the *parent* of the traversable where the page was found, as the parent of the page. This seems to make more sense than making it a child of its own traversal adapter, and removed a bit of kludginess from the DOMlet->webpage adapter.
Rename/refactor from model/view/pattern to domlet/define. Fixed broken XML namespace support. (Expat doesn't give you namespace events unless you also have it skip xmlns: attributes, which doesn't work for us because we need to reproduce the input document as closely as possible.) Added another unit test, which is what caught the xmlns problem. RenderTo() signature still needs review. (And not just because it still includes a 'currentModel' parameter!)
The templates have landed! We can parse and render templates, and use them as web methods on locations. There's even a (yes, just one) unit test. Big TODO lists both in the package and its test suite, but at least it's working. Made minor adjustments to publishing algorithms so that locations know their parent locations, and methods know the location that they were found in. Bumped package version to 0.5a3, since we've been in the alpha 3 cycle for a while now.
Drafted rough equivalents to "var" and "in". Refactored model and publishing traverals to use a name class (LocationPath) that knows how to do traversal. Moved Zope request subclasses to a separate module, so that you don't have to have Zope installed just to use templates (important for testing!). Made 'peak.naming' name classes (compound/composite and any derivative thereof) support 'adapt(stringOrUnicode,nameClass)' by parsing.
Added error protocol, skin service, and adjustments to location protocol. Exceptions thrown by web apps are now adapted to an "error protocol", so you can define per-app, per-exception class, exactly what actions should be taken. There is now trivial support for a "skin service" that determines what skin is used for a given request, but it's not used for anything yet. Finally, the location protocol now includes the ability to suppress security checks for a traversal operation. This is intended to allow easy but uniform access to interaction-level variables and to skin resources by application code.
Got rid of the 'adaptTo' requirement for retrieving objects from naming contexts. Note that if you have defined any URL schemes that do not also define a naming context class, you will need to revise them. Specifically, you need to add a 'defaultFactory' attribute referencing the name of the class of object that the URL should retrieve, and you need to have that class declare that it (not its instances) provide 'naming.IObjectFactory', and add a 'getObjectInstance()' classmethod to do the dirty work. If your URL scheme references a subclass of ManagedConnection, you don't need to do the object factory stuff, however, as it's already done for you in the ManagedConnection base. All you need is the 'defaultFactory' attribute. Also, if you defined any adapter declarations for your URLs to the target class, you should get rid of them.
Refactor BaseInteraction -> Interaction + InteractionPolicy. Added config properties for 'peak.web.authenticationService', 'peak.web.appLog', and 'peak.web.defaultMethod'. Integrated default method handling (e.g. 'index_html'), and default authentication, thus trimming the 'trivial_web' example down to a mere 10 lines.
The PEAK_CONFIG environment variable can now list multiple files, separated by the platform's 'os.pathsep' (e.g. ':' on Unix, ';' on Windows).
Initial import of N2 (Namespace Navigator) utility. This is a sort of all-purpose Swiss Army Knife for PEAK. It's a sh-like shell for navigating peak.naming contexts, complete with IO redirection! It's an enhanced Python interactive command line! It's a sqsh-like interactive database shell [1]! It's an extensible environment for interacting with any python object! It's a floor wax, and a desert topping! This is an almost total rewrite of the (unreleased) original. It was completely refactored to take advantage of adaption [2], changes in peak.naming, the peak.running commands stuff, completely rewritten argument parsing code, and more. This fixed all sorts of ugliness in the original code, and made it much more extensible. Note that this has not been tested much, especially the namespace shell, because "nis:" has stopped working and that was my primary test case. It also needs documentation and there are still some things to do to the code... But you can play with it now. usage: peak n2 [-e] [-p] [name] -e if name lookup fails, go into python interactor anyway -p use python interactor even if there is a more specific interactor (implies -e) [1] The SQL interactor has not been ported from the old code yet, but that's coming soon. [2] Phillip makes fun of me for saying adaption instead of adaptation, but dictionary.com say "adaption" is OK. :-) Besides, "adaption" sounds like it goes with adapt(). Seems like adaptation would have a function called adaptate() ;-). And for that matter, shouldn't Canadians come from a country called Canadia?
'peak.web' is born; just interface sketches and a draft of 'BaseInteraction' for now. CGI support has been moved from 'peak.running.zpublish' into 'peak.running.commands' (for "raw" CGI/FastCGI) and 'peak.web' (for the PEAK high-level publishing framework). You can use 'peak CGI someName' to adapt 'someName' to a 'running.IRerunnableCGI' and run it as a CGI/FastCGI. This will form the basis for creating the web version of an app later; you'll do something like:: class MyAppAsCGI(web.CGIPublisher): app = binding.New(MyAppClass) And then use 'peak CGI import:somepkg.MyAppAsCGI' to run it. Or, if your app wants to exec a config file, you might define your CGIPublisher subclass as an adapter from MyAppClass to IRerunnableCGI, rather than invoking it directly.
Added SQLite support; smoke tested w/PySQLite 0.4.3 on Win32.
'peak.naming' no longer automatically converts all addresses to the addressed objects. You must specifically request the interface you want by adapting the retrieved object to that interface. This can be done by supplying an 'adaptTo=ISomething' keyword argument to the attribute binding definition or your 'lookupComponent()' call. The naming system no longer has 'objectFactories' and 'stateFactories'; these have been replaced with adaptation. Writable naming contexts must have a 'serializationProtocol' attribute specifying what interface an object should be adapted to before attempting to store it in that context. The naming system no longer processes the 'creationName' keyword argument; this is now considered the sole responsibility of 'peak.binding'. The 'IComponent.lookupComponent()' method still accepts the keyword argument, and attribute bindings still handle the creation name transparently. It is just not available via naming system APIs, and naming contexts no longer have to deal with it. Also, removed 'naming.ParsedURL'; it was deprecated as of 0.5 alpha 2. (Note: 'smtp:' URLs are currently broken, in that we don't have an interface to adapt them to for retrieval, and I didn't want to create an SMTP naming context, since what we want to do with SMTP is still up in the air.)
Begin retrieval->adaptation refactoring. ZConfig, lockfiles, logs, and files now all support adaptation and/or have been converted to contexts. Up next: SQL, LDAP, UUIDs, DDE, SMTP, and shellcmd:. After that, retrieve goes away altogether, followed by creationName/creationParent. It would be a good idea for you to start right away on adding 'adaptTo=IWhatever' to all your bindings that use the naming system to retrieve logs, locks, connections, etc.
Changed 'import:' URLs to use a custom context, so they'll retrieve actual objects instead of addresses once we switch to adaptation-oriented lookups.
Added a 'shellcmd:' URL scheme that returns a function that calls 'os.system()' on the body of the URL. It's intended for use as a command factory, as is needed by the 'URLChecker' periodic task.
Fixed a problem where local name resolution could infinitely recurse. Added a new 'EmptyContext' naming context, that is now used as the default initial naming context; this allows "off the top of the tree" acquisition errors to correctly generate 'NameNotFound' instead of 'NotImplementedError' or other strange error messages. Added test for the previously broken condition. The bug was introduced post-alpha1. Thanks to Oleg Broytmann for catching this problem.
Added a ZConfig schema for 'running.commands.EventDriven' applications, a ZConfig component definition for adaptive tasks, and a running shortcut called 'EventDriven'. It should now be possible to do this:: #!/usr/bin/env peak EventDriven at the top of a ZConfig file formatted according to the new schema, and have it run. Unfortunately, so far the only type of task that can be included is 'running.daemons.AdaptiveTask', which doesn't actually *do* anything. So, right now doing this is equivalent to creating an over- engineered 'sleep' command. ;) Also, fixed a problem in ZConfig 'schema.dtd'; I used 'PCDATA' where I should've used 'CDATA', and I fixed various problems with the 'fromZConfig()' component constructor. It's kind of annoying that ZConfig defaults unspecified items to 'None', even if you said they weren't required and had no default. :( I'll see if I can do something about this later; for now I just delete 'None' values from the data.
Added ZConfig URL support. ZConfig schemas and files can be loaded from any PEAK-supported stream URL, including 'pkgfile:'. Interfile references aren't tested yet, nor are there any unit tests. Those will be added once we have some meaningful schemas and configurations to test with. There is a 'zconfig.schema' URL scheme that loads a command interpreter, and a 'peak ZConfig' option as well. See 'CHANGES.txt' for details on the new features. Also, fixed up some issues with the 'fromZConfig()' component constructor. All we need now are some useful base schemas for daemons, and the last piece for 0.5a2 (besides PyProtocols) will be in place.
Standardized file-based URL syntaxes (e.g logfiles and lockfiles) to follow RFC 1738/2396, and Python 'urllib'. This shouldn't affect much besides the canonical forms of the URLs. Added 'pkgfile:some.pkg/filepath' URL syntax for ease of referring to files near modules. (A convenience intended mainly for referencing ZConfig schemas.)
Added the UML 1.4 metamodel, and thus the ability to load UML 1.4 models encoded in XMI 1.1. Added support in the mof2py code generator for "unprefixing" enumerated values, so that UML and other metamodels' enumerations work correctly when loading from XMI. Fixed source distributions missing essential setup files. Rescheduled UML 1.5 and CWM support to version 0.6. Hardly any tools use UML 1.5 yet, and we can't do anything useful with CWM until we have XMI writing, and some type of UI for editing models.
Added a 'peak.running.shortcuts' command to run the unit tests. Now I'm also testing the command subsystem every time I run the tests... :)
Refactoring to support "canonical formatting" of URLs. This required creating a sizeable parsing/formatting framework. :( On the brigher side, the framework is highly powerful and expressive. Potentially it could be pulled out as a 'peak.model' parsing framework, to be reused for other parse/format applications on model elements that have a single canonical string syntax. It would probably need to be reviewed for Unicode compatibility, however. Anyway, now printing a parsed URL object should give you back a canonical form of that URL; equivalent URLs (apart from case-sensitivity issues) should produce identical canonical forms. Passing keyword arguments to a URL constructor should also allow you to selectively override the URL body content, making it easy to produce new versions of a URL with an altered field.
Implemented log system refactoring; also added tests for misc. URL schemes. See CHANGES.txt and my mailing list post for details.
Normalized whitespace.
Paramegeddon! Adjusted API signatures so that all calls that have a context component, have it as the first parameter. Changed functions, methods, and classes are: * binding.acquireComponent() * binding.lookupComponent() * config.getProperty() * config.findUtility() * config.findUtilities() * config.PropertyMap.getValueFor() * config.IConfigSource._getConfigData() * config.PropertySet() * naming.lookup() * naming.parseURL() Also, renamed 'config.LazyLoader' -> 'config.LazyRule' to reduce confusion with 'storage.LazyLoader', which has a very different purpose/function.
"As We Planned-it of the APES, The Final Chapter". Removed AppConfig/SysConfig classes and APIs. Renamed 'instancePerApp()' to 'provideInstance()' (since it now just provides a single instance), and added 'instancePerComponent()' (which provides a fresh instance per target component). Some files have whitespace-only changes.
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.
Semi-final draft of the 'peak.running.commands' framework. It's now possible to bootstrap almost anything to run as a PEAK command object; see 'running.IExecutable'. Added new 'peak' script (Posix-like OSes and Cygwin only) that can bootstrap execution of any URL or .ini-defined shortcut. Moved CGI/FastCGI publishing command objects to 'peak.running.zpublish', since they aren't useful without the ZPublisher stuff anyway. Added "usage" capabilities for commands to display usage help and to be able to distinguish invocation errors from execution errors. Note: the diffs for this are going to suck from a readability POV, because diff doesn't deal well with the removal of a huge block of code in the same revision as significant doc rewrites or refactoring within classes. :(
Revised 'urlopen()' support to follow 'IStreamFactory', and expanded the 'IStreamFactory' interface a bit to include 'exists()' and 'delete()' methods. Split off new 'FileURL' and 'FileStreamFactory' classes that implement 'IStreamFactory' for files. Last, but not least, dropped the entry for the 'gopher' protocol (what was I thinking?)
Added 'OpenableURL' class that uses 'urllib2.urlopen()' to retrieve data. Now you can do 'naming.lookup("http://peak.telecommunity.com").read()' and retrieve the PEAK home page.
Finished the bulk of the "daemon" refactoring. There are now separate interfaces for different aspects of task scheduling and event loop management. An 'ITaskQueue' schedules prioritized periodic tasks, an 'IMainLoop' controls activity monitoring and timeouts, and an 'IBasicReactor' or 'ITwistedReactor' handles I/O and scheduled event processing. There are default implementations of all scheduling interfaces (including an untested 'UntwistedReactor' for use when Twisted isn't needed or available), and they are registered in 'peak.ini' as utility providers. In addition, I added two application-related interfaces, 'ICmdLineApp' and 'ICmdLineAppFactory'. These are intended to form the basis of a framework for handling CGI, FastCGI, or any other command-line invocation protocol such as ReadyExec. That is, a protocol handler for (say) FastCGI would invoke an 'ICmdLineAppFactory' to create an 'ICmdLineApp' with a given stdin, stdout, stderr, environ, and argv, ready to be 'run()'.
Added "win32.dde" URL scheme; fixed DDE server shutdown sometimes waiting until GC occurred.
Got rid of deprecated 'peak.model' classes: Model, Package, Reference, etc.
Added feature list to README, in preparation for use as a release announcement, and removed trailing whitespace from peak.ini. Note that features listed in the README may not actually be implemented yet! (At the moment, that's just XMI writing, which is still in development, but I may add other items to the README soon.) Yes, this does mean that I'm preparing for an actual 0.5a1 release. I expect to begin using PEAK at work soon, which means we need to have stable (in the sense of "unchanging") baseline versions for change management of software that uses PEAK.
Added support for XMI DM's to look up metamodels via properties. The 'peak.xmi.metamodels' property namespace will be checked for a property named 'name.version' where 'name' is the 'xmi.name' attribute of the 'XMI.metamodel' tag, and 'version' is the 'xmi.version' attribute, if present. The property value should be the appropriate metamodel module. The 'DM.importFromXMI()' method has been replaced with a module-level function, 'storage.xmi.fromFile()'. For most simple XMI-processing programs, simply calling the function to get back the top-level content list for a specified file or URL should be sufficient. It's still possible, however, to manually specify a metamodel, using the 'metamodel' keyword argument to 'fromFile()'. In addition, this checkin contains some changes I previously made to simplify the "peak.ini" using the new 'config.instancePerApp()' API, but accidentally skipped checking in. Last, but not least, there are some changes to 'peak.model.features' that make it easier to introspect a feature's CORBA typecode kind (which is important for XMI writing), and I stripped trailing whitespaces from the source of the 'peak.storage.data_managers' module. (I should be stripping them from many more modules too, as soon as I figure out how to automate it on a multi-file basis in jEdit.)
Misc. improvements to code generation, such as the ability to write to files and directories (with the 'writeFiles' option of the "fileset" format), more polished code prologues and epilogues, lazy importing of all interdependencies and subpackages in generated code, and fixes to ensure PEAK-specific names don't conflict with generated names (unless of course they start with two underscores). This is getting pretty close to being done, apart from primitive types and XMI name registry support.
Fixed some of the relative naming and package interdependency issues with MOF code generation. Added two new output formats: "outline", which generates a text outline of the MOF package structure, and "fileset", which generates a list of '(filename,contents)' tuples that represent the ('/'-separated) filenames and their contents that would render the MOF package as a Python package. It's getting a lot closer to being useful, but there's still a fair way to go. Support for primitive types, and relative links for 'referencedType' fields need to come next.
More docs and code cleanup for 'peak.naming'. Moved syntax-related classes to a separate module, 'naming.syntax'. Renamed 'Syntax' class to 'PathSyntax', to distinguish from the 'URLSyntax' helper that I'll be adding later. Got rid of legacy names for NameContext/AddressContext classes, and made NameContext and AddressContext accessible via the API, so context implementers don't have to import from peak.naming.contexts. (If you're using the naming system at all, it's pretty much guaranteed that something's going to import those classes, so we might as well put them in the API.)
Hierarchical contexts and composite namespaces work now. I had to refactor some of the context base class internals to get this to work reasonably, and there are now some new methods that can be overridden. In the simple case, overriding '_contextNNS()' lets you handle per-context NNS pointers. (And in the really simple case, you can ignore it altogether.) If you want to support explicit NNS pointers, you can override _get_nns(), _bind_nns(), and _unbind_nns() as well. The rules of name arithmetic have changed slightly; any addition that previously returned a composite name will now return a compound name, if it is possible to do so without changing the meaning of the returned name. Similarly, the parser for nesting a compound name inside a composite name, will return just a compound name if possible/appropriate. There are new 'naming.isBoundary()' and 'naming.crossesBoundary()' APIs that can be used to check if a name is a terminal namespace boundary, or crosses namespace boundaries, respectively. The name parsing tests have been updated for arithmetic and parsing changes, and also to use the new naming.parseURL() function instead of performing partial retrievals on the names. Finally, a new 'config:' URL scheme has been added, as a demo of the finished hierarchy and composite name support. For example, 'config:environ.TMP' refers to a 'PropertyContext()' for that property namespace, but 'config:environ.TMP/' returns the value of 'environ.TMP'. Similarly, 'naming.lookup("config:environ")["TMP/"]' returns the value, while 'naming.lookup("config:environ")["TMP"]' is just another naming context.
Major refactoring of naming system base classes for contexts and names. Enhancements include "name subtraction", smart resolution algorithms for both name-based and address-based contexts, improved syntax objects, URL-compatible syntax for CompositeName objects, with the ability to nest the parsing of a CompositeName's first element to a specific compound name syntax. Lots more tests, ability to specify a field of a URL as a hierarchical name object, simplified subclassing API for ParsedURL and naming contexts, and ParsedURLs can now have attribute bindings. All this stuff really needs a *lot* of documentation, but my brain is too fried to even think about trying to write it prior to this checkin.
Moved remaining utility/property functions from binding -> config. This should make it a little easier to finish tutorial chapter 2... ;) Seriously, these functions aren't really about binding, even though they're called by certain attribute bindings. They're about finding configuration data.
Misc. cleanups to NIS context implementation: Got rid of 'nisMapContext.__init__', since it was skipping standard component initialization (a no-no since this means the new context wouldn't have the 'nisURLContext' object as its parent), and replaced it with a standard keyword argument init, and added a 'requiredBinding()' to describe the need for the keyword argument to be passed. We could set this from a property if not supplied, but it seems like overkill for an example.
A NIS (formerly YP) URL and namespaces. A somewhat decent example of writing namespaces. Good: the actual "work" is very simple one-line calls into the nis module -- it's almost all wrapper, so details of what it actually does doesn't distract from understanding how the contexts and such work. Bad: Unix-only. Actually, Unix-with-nis-configured-only. Anyway: 'nis:' namespace that you can iterate over to find maps, or look up a map namespace by name 'nis:mapname' get a map namespace, which you can iterate or lookup by key in 'nis:mapname/key' lookup key in mapname All of the following work identically, which is kinda neat: naming.lookup('nis:')['passwd.byname']['tsarna'] naming.lookup('nis:')['passwd.byname/tsarna'] naming.lookup('nis:passwd.byname')['tsarna'] naming.lookup('nis:passwd.byname/tsarna') (of these, #3 would probably the most useful form in a real application)
Moved Provider and CachingProvider from binding->config, where they're a better fit.
Enable lockfile url -- forgotten from earlier commit
first pass at postgres support (pgsql: urls)
Added [Load on demand] rules section, and made running.clusters use it. Also added basic unit tests for peak.running.clusters.
Components now support names and paths: * Objects created by naming system lookup, binding.New(), or AutoCreated, can all now automatically receive information about their name as well as their parent component. * binding.getComponentName() gets an object's name or 'None' * binding.getComponentPath(c, relativeTo=None) gets an object's path from its root component, or as a relative path from 'relativeTo' (assumes 'relativeTo' is a parent of 'c'). Unknown names are rendered as '*' in the path. * Added 'binding.Acquire' after all. * Improved management of _p_jar/_p_oid by model.Element, using _p_jar as the parent component, and _p_oid as the component name for elements. * Added unit tests for name and path support.
Fixed a problem with object/state factory properties returning generators instead of lists.
Added working support for Gadfly. Misc. cleanups/fixes and TODO updates.
Got rid of BasicInitialContext, by moving the defaults it supplied to rules in peak.ini. Simplified miscellaneous related property lookups, etc.
Added rudimentary Sybase support.
Added support for comments in CLUSTER files, as per Clusterit 2.0 docs.
Reformatted peak.running.clusters docstring to structured text for better HappyDoc output. Defined the rule for 'peak.running.cluster._filename' in peak.ini instead of in the code. Renamed PropSet to PropertySet, and made it possible to go from a PropertyName to a PropertySet by calling '.of()' (e.g. 'PropertyName("foo").of(anObj)'. PropertySets can now reproduce in various ways, e.g.: c = PropertyName('peak.running.cluster').of(None) # -> PropertySet c._host['two.baz.com'] # ('even','prime','weird') c._groups() # ('odd','even','prime','weird','qux') But none of this is documented yet and possibly subject to change. :) (Especially since we're probably going to change how the cluster namespace works anyhow!) Ideally, it should be easy to go from a property name to its value or to a property set, and to go from a property set to a value in some namespace. Of course, it's somewhat questionable whether we'll be doing this for that many properties in the first place! And this is all going to go "full circle" once properties have a naming context that can be used to look them up in. I worry a bit about creeping TMTOWTDI-ism in all this. :(
Support for peak.running.cluster.* properties, with clusterit/PSSP-style information on loosely-coupled clusters of computers. See peak.running.clusters docstring form more information.
More/better docs for [Provide Utilities] section of peak.ini.
Added a '__main__.*' namespace, which is loaded from the __main__ (startup) module, and which has automatic fallback to the 'environ.*' namespace for anything not defined in the __main__ module. We now load a file specified by __main__.PEAK_CONFIG, which means that a script can simply specify PEAK_CONFIG as a global variable, and override the environment. Combined with the other changes, this means that you could do something like this: PEAK_CONFIG = config.fileNearModule('myLocalModule','config.ini') And that .ini file could then contain something like this: [Load settings from] file = config.getProperty('environ.PEAK_CONFIG',default=None) To also load in the PEAK_CONFIG specified by the environment, if any. I think this is now flexible enough for anybody, especially since I was able to make this latest change without editing anything but peak.ini! :)
*Really* fixed the local/global config startup recursion loop. Config objects now perform their "setup" operation lazily, upon the first attempt to get configuration data from them. By the time this happens, the default local and global config objects will already be registered, so all system invariants should be in effect. Fixing this now allows the addition of Ty's requested PEAK_CONFIG environment variable load operation; so you can now specify PEAK_CONFIG to point to an additional config file, similar to "peak.ini", that can do any necessary site-, user-, or application-specific setups. Since that file can include others (and those still others) without limit, PEAK_CONFIG names only one file.
* Added 'binding.Constant(key, value)', which allows you to specify a constant value to be used as a property or utility in that component subtree. * Added storage.get/begin/commit/abortTransaction() APIs for ease of use in short scripts. Defined a default provider for ITransactionService in peak.ini that provides each component root with its own TransactionService instance. It's easily replaceable with other allocation strategies, if it should be needed. I may change this later to a per-root strategy, since the current strategy requires creating localConfigs for each component root. We'll see what actual use has to say about the best way of doing it. * Fixed a problem with local/global config object startup that could cause "phantom" configuration objects to appear via recursion of getLocal() or getGlobal(). * Got rid of binding.meta.assertInterfaces, which is no longer needed because the Interface package now correctly handles metaclass instances. * Got rid of Singleton, since it's not used for anything and I could neither think of any use cases nor remember why I added it in the first place! * Made it possible for CachingProviders to cache per-localConfig as well as per-object. This is handy for implementing per-hierarchy services, like the TransactionService provider mentioned above. * Misc. TODO updates.
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
Completed configuration files refactoring. Configuration files now can have [Load Settings From] and [Provide Utilities] sections, and property sections can now define rules instead of just values. Property values are eval()'d at rule access time rather than configuration loading time, and they have access to 'propertyMap', 'propertyName', and 'targetObj' locals, as well as the full peak.api.* and config_components' globals. "Load Settings From" sections can access a potentially infinite variety of sources for loading configuration data; the sources are defined using the 'peak.config.loaders.*' property namespace, and thus can be meta-configured even in the same configuration file. Builtin loader types are 'file' and 'mapping'. GlobalConfig no longer has any hard-wired configuration steps; everything is now in the peak.ini file. Subclasses of GlobalConfig need only perform 'self.config_filenames.append(fname)' before calling GlobalConfig's 'setup()' method, to cause additional config files to be loaded after 'peak.ini'. Everything that is configurable in PEAK, is now (in principle) configurable via property files.
Added a basic configuration file format, and used it to replace the schemes dictionary in peak.naming.factories, by adding a "peak.ini" global configuration file for PEAK builtins. This means that the factories subpackage is pretty much useless now; the URL classes can easily move anywhere now, like to the same modules as the implementations. It should now be easy to add lots of address schemes to PEAK. Also, subclasses of GlobalConfig can change the list of filenames used to load configuration settings, and thus perhaps read a ~.peakrc or /etc/peak.ini file, or an app-specific global configuration file. The file format is very primitive right now: ConfigParser with eval() of the settings done at file load time. Ultimately, this should move to a true lazy evaluation mode, and there are some syntactic sugar features that should be added. For right now, however, all we need are constant expressions. Last, but not least, fixed a bug in the fromURL() method of ParsedURLs.
cvs-admin@eby-sarna.com Powered by ViewCVS 1.0-dev |
ViewCVS and CVS Help |