E&S CVS Commit: PEAK - Extensible cursor formatter support

tsarna at eby-sarna.com tsarna at eby-sarna.com
Thu Dec 25 10:47:00 EST 2003


Module Name:	PEAK
Committed By:	tsarna
Date:		Thu Dec 25 15:46:41 UTC 2003

Modified Files:
	PEAK/src/peak: peak.ini
	PEAK/src/peak/storage: connections.py interfaces.py
Added Files:
	PEAK/src/peak/storage: cursor_formatters.py

Log Message:
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)


To view diffs of this commit, you can use the following URL(s):
http://cvs.eby-sarna.com/PEAK/src/peak/peak.ini.diff?r1=1.105&r2=1.106
http://cvs.eby-sarna.com/PEAK/src/peak/storage/connections.py.diff?r1=1.22&r2=1.23
http://cvs.eby-sarna.com/PEAK/src/peak/storage/cursor_formatters.py?rev=1.1&content-type=text/vnd.viewcvs-markup
http://cvs.eby-sarna.com/PEAK/src/peak/storage/interfaces.py.diff?r1=1.34&r2=1.35

To generate a diff of this commit:
cvs rdiff -r1.105 -r1.106 PEAK/src/peak/peak.ini
cvs rdiff -r1.22 -r1.23 PEAK/src/peak/storage/connections.py
cvs rdiff -r0 -r1.1 PEAK/src/peak/storage/cursor_formatters.py
cvs rdiff -r1.34 -r1.35 PEAK/src/peak/storage/interfaces.py

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.




More information about the source-changes mailing list