[Subversion] / PEAK / src / peak / util / Struct.py  

Log of /PEAK/src/peak/util/Struct.py

Parent Directory

No default branch
Bookmark a link to HEAD: (view) (download) (as text)


Revision 1076 - (view) (download) (as text) - [select for diffs]
Modified Sat May 3 13:21:20 2003 UTC (21 years ago) by pje
File length: 8657 byte(s)
Diff to previous 692 , to selected 593
Normalized whitespace.

Revision 692 - (view) (download) (as text) - [select for diffs]
Modified Sun Nov 17 02:41:03 2002 UTC (21 years, 5 months ago) by pje
File length: 8782 byte(s)
Diff to previous 599 , to selected 593
Added LDAP field type converter support, with unit tests.  This uses the
'peak.ldap.field_converters.*' property namespace, looking up the field
names to find a converter (or import string thereof) that takes two
arguments (name and value) and returns a replacement value.  The value
passed in may be 'None' if no value was present in the retrieved data.
Otherwise, it's a list of values returned from the LDAP directory (except
for the 'dn' field, which is always just a string.)  Converters are
imported from within the peak.storage package, so we can add some
"standard" converters and then reference them with import strings
like '"LDAP.someConverter"'.

Revision 599 - (view) (download) (as text) - [select for diffs]
Modified Mon Nov 4 01:35:11 2002 UTC (21 years, 5 months ago) by pje
File length: 8690 byte(s)
Diff to previous 593
Standardized call signature for metaclass.__new__ methods as
__new__(meta, name, bases, ...) to make it easier to find metaclass __new__
methods (as opposed to class __new__ methods).  Eliminated a metaclass
__new__ that wasn't needed (replaced with an __init__).  There are now only
two PEAK metaclasses that use __new__: structType and Singleton.  Neither
is particularly likely to need mixing with Persistent.__class__, so we
should be able to steer clear of any danger that might come about from
Persistent.__class__ being somewhere other than at the end of the __bases__
list.

Whew!  I think that finally concludes the integration of Persistent into
the model.Element base class; so now it should be possible to create
Element subclasses and store the instances in Racks.

Revision 593 - (view) (download) (as text) - [selected]
Modified Sun Nov 3 19:47:29 2002 UTC (21 years, 5 months ago) by pje
File length: 8694 byte(s)
Diff to previous 580
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

Revision 580 - (view) (download) (as text) - [select for diffs]
Modified Wed Oct 30 23:06:35 2002 UTC (21 years, 6 months ago) by pje
File length: 8620 byte(s)
Diff to previous 518 , to selected 593
Misc. docstring fixes for better summaries in generated API docs.

Revision 518 - (view) (download) (as text) - [select for diffs]
Modified Sun Sep 29 02:01:31 2002 UTC (21 years, 7 months ago) by pje
File length: 8621 byte(s)
Diff to previous 455 , to selected 593
Added DBCursor and LDAPCursor to peak.storage, along with their
corresponding interfaces.  ManagedConnections now support registerCursor()
and closeCursors() methods, as well as __call__() to create a new cursor
and optionally execute a query on it.  Cursor objects can be iterated over
to return rows, inverted to return a single row, or processed for
multi-sets as in::


    row = aConn('SQL that returns exactly one row').justOne()

    # shortcut for the above
    row = ~ aConn('SQL that returns exactly one row')

    # multiple result sets
    rs1, rs2 = aConn('SQL that returns 2 result sets').allSets()

    # iteration

    for row in aConn('SQL that returns 0-n rows, in 1 set'):
        # do something

Rows returned are 'struct' objects (a cross between a tuple, dict, and
object w/attributes), unless the underlying DB returns non-standard rows.
The LDAPCursor class also iterates over asynchronously retrieved results,
but isn't very well tested at this point.  None of this has been tested
with actual databases, just a few mockup test harnesses.

To support all this, I also needed to add a 'hasBinding()' method to
binding.Base and an 'addField' method to the 'structType' metaclass.

Revision 455 - (view) (download) (as text) - [select for diffs]
Modified Sun Jul 7 19:17:46 2002 UTC (21 years, 9 months ago) by pje
File length: 8283 byte(s)
Diff to previous 451 , to selected 593
Fixed up struct's constructor calling patterns to be a bit more sensible,
and adjusted naming classes accordingly.

Revision 451 - (view) (download) (as text) - [select for diffs]
Modified Fri Jul 5 22:27:23 2002 UTC (21 years, 9 months ago) by pje
File length: 7910 byte(s)
Diff to previous 440 , to selected 593
Fixed some class/type problems with NamingExceptions; refactored URL
classes to use the new 'struct' class as a base type.

Revision 440 - (view) (download) (as text) - [select for diffs]
Modified Wed Jul 3 12:48:50 2002 UTC (21 years, 10 months ago) by pje
File length: 7455 byte(s)
Diff to previous 439 , to selected 593
Refactored struct metaclass for cleaner construction.  Misc. doc additions.

Revision 439 - (view) (download) (as text) - [select for diffs]
Added Wed Jul 3 10:54:39 2002 UTC (21 years, 10 months ago) by pje
File length: 7063 byte(s)
Diff to selected 593
Added new 'struct' type to serve as a basis for compact, immutable object
classes.  Structs are tuples on the inside, dictionaries on the outside,
plus whatever properties and methods you care to add.  They also offer a
wide variety of constructor options, including the string parsing of your
choice, and the ability to define new constructors of your own devising.
This class will end up being the base class for many PEAK objects,
including naming.ParsedURL, storage.SQLRecord, storage.LDAPRecord, and
so on.

This form allows you to request diffs between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.

  Diffs between and
  Type of Diff should be a

Sort log by:

cvs-admin@eby-sarna.com

Powered by ViewCVS 1.0-dev

ViewCVS and CVS Help