+ +
+

pyams_zodbbrowser package

+ +
+

Submodules

+
+
+

pyams_zodbbrowser.btreesupport module

+

BTrees are commonly used in the Zope world. This modules exposes the +contents of BTrees nicely, abstracting away the implementation details.

+

In the DB, every BTree can be represented by more than one persistent object, +every one of those versioned separately. This is part of what makes BTrees +efficient.

+

The format of the picked BTree state is nicely documented in ZODB’s source +code, specifically, BTreeTemplate.c and BucketTemplate.c.

+
+
+class pyams_zodbbrowser.btreesupport.BTreeContainerState(type, state, tid)
+

Bases: pyams_zodbbrowser.state.GenericState

+

Convenient access to a BTreeContainer’s items

+
+
+listItems()
+
+ +
+ +
+
+class pyams_zodbbrowser.btreesupport.EmptyOOBTreeState(type, state, tid)
+

Bases: pyams_zodbbrowser.btreesupport.OOBTreeState

+

Empty OOBTrees pickle to None.

+
+ +
+
+class pyams_zodbbrowser.btreesupport.FolderState(type, state, tid)
+

Bases: pyams_zodbbrowser.state.GenericState

+

Convenient access to a Folder’s items

+
+
+listItems()
+
+ +
+ +
+
+class pyams_zodbbrowser.btreesupport.OOBTreeHistory(obj)
+

Bases: pyams_zodbbrowser.history.ZodbObjectHistory

+
+
+loadState(tid=None)
+
+ +
+
+loadStatePickle(tid=None)
+
+ +
+
+rollback(tid)
+
+ +
+ +
+
+class pyams_zodbbrowser.btreesupport.OOBTreeState(type, state, tid)
+

Bases: object

+

Non-empty OOBTrees have a complicated tuple structure.

+
+
+asDict()
+
+ +
+
+getError()
+
+ +
+
+getName()
+
+ +
+
+getParent()
+
+ +
+
+listAttributes()
+
+ +
+
+listItems()
+
+ +
+ +
+
+class pyams_zodbbrowser.btreesupport.OOBucketState(type, state, tid)
+

Bases: pyams_zodbbrowser.state.GenericState

+

A single OOBTree bucket, should you wish to look at the internals

+

Here’s the state description direct from BTrees/BucketTemplate.c:

+
* For a set bucket (self->values is NULL), a one-tuple or two-tuple.  The
+* first element is a tuple of keys, of length self->len.  The second element
+* is the next bucket, present if and only if next is non-NULL:
+*
+*     (
+*          (keys[0], keys[1], ..., keys[len-1]),
+*          <self->next iff non-NULL>
+*     )
+*
+* For a mapping bucket (self->values is not NULL), a one-tuple or two-tuple.
+* The first element is a tuple interleaving keys and values, of length
+* 2 * self->len.  The second element is the next bucket, present iff next is
+* non-NULL:
+*
+*     (
+*          (keys[0], values[0], keys[1], values[1], ...,
+*                               keys[len-1], values[len-1]),
+*          <self->next iff non-NULL>
+*     )
+
+
+

OOBucket is a mapping bucket; OOSet is a set bucket.

+
+
+asDict()
+
+ +
+
+getError()
+
+ +
+
+getName()
+
+ +
+
+getParent()
+
+ +
+
+listAttributes()
+
+ +
+
+listItems()
+
+ +
+ +
+
+

pyams_zodbbrowser.cache module

+
+
+pyams_zodbbrowser.cache.expired(cache_dict, cache_for)
+
+ +
+
+pyams_zodbbrowser.cache.getStorageTids(storage, cache_for=300)
+
+ +
+
+

pyams_zodbbrowser.diff module

+
+
+pyams_zodbbrowser.diff.compareDicts(new, old)
+

Compare two state dictionaries, return dict.

+
+ +
+
+pyams_zodbbrowser.diff.compareDictsHTML(new, old, tid=None, indent='')
+

Compare two state dictionaries, return HTML.

+
+ +
+
+pyams_zodbbrowser.diff.compareTuples(new, old)
+

Compare two tuples.

+

Return (common_prefix, middle_of_old, middle_of_new, common_suffix)

+
+ +
+
+pyams_zodbbrowser.diff.compareTuplesHTML(new, old, tid=None, indent='')
+

Compare two tuples, return HTML.

+
+ +
+
+pyams_zodbbrowser.diff.isascii(s)
+

See if the string can be safely converted to unicode.

+
+ +
+
+

pyams_zodbbrowser.history module

+
+
+class pyams_zodbbrowser.history.ZodbHistory(connection)
+

Bases: object

+
+
+tids
+
+ +
+ +
+
+class pyams_zodbbrowser.history.ZodbObjectHistory(obj)
+

Bases: object

+
+
+lastChange(tid=None)
+
+ +
+
+loadState(tid=None)
+
+ +
+
+loadStatePickle(tid=None)
+
+ +
+
+rollback(tid)
+
+ +
+ +
+
+

pyams_zodbbrowser.state module

+
+
+class pyams_zodbbrowser.state.ContainedProxyState(proxy, state, tid)
+

Bases: pyams_zodbbrowser.state.GenericState

+
+
+asDict()
+
+ +
+
+getName()
+
+ +
+
+getParent()
+
+ +
+
+listAttributes()
+
+ +
+
+listItems()
+
+ +
+ +
+
+class pyams_zodbbrowser.state.DecoyPersistentDict(*args, **kwargs)
+

Bases: persistent.mapping.PersistentMapping

+

Decoy to avoid ZCML errors while supporting both ZODB 3.8 and 3.9.

+
+ +
+
+class pyams_zodbbrowser.state.FallbackState(type, state, tid)
+

Bases: object

+

Fallback when we’ve got no idea how to interpret the state

+
+
+asDict()
+
+ +
+
+getError()
+
+ +
+
+getName()
+
+ +
+
+getParent()
+
+ +
+
+listAttributes()
+
+ +
+
+listItems()
+
+ +
+ +
+
+class pyams_zodbbrowser.state.GenericState(type, state, tid)
+

Bases: object

+

Most persistent objects represent their state as a dict.

+
+
+asDict()
+
+ +
+
+getError()
+
+ +
+
+getName()
+
+ +
+
+getParent()
+
+ +
+
+listAttributes()
+
+ +
+
+listItems()
+
+ +
+ +
+
+class pyams_zodbbrowser.state.LoadErrorState(error, tid)
+

Bases: object

+

Placeholder for when an object’s state could not be loaded

+
+
+asDict()
+
+ +
+
+getError()
+
+ +
+
+getName()
+
+ +
+
+getParent()
+
+ +
+
+listAttributes()
+
+ +
+
+listItems()
+
+ +
+ +
+
+class pyams_zodbbrowser.state.OrderedContainerState(type, state, tid)
+

Bases: pyams_zodbbrowser.state.GenericState

+

Convenient access to an OrderedContainer’s items

+
+
+listItems()
+
+ +
+ +
+
+class pyams_zodbbrowser.state.PersistentDictState(type, state, tid)
+

Bases: pyams_zodbbrowser.state.PersistentMappingState

+

Decoy to avoid ZCML errors while supporting both ZODB 3.8 and 3.9.

+
+ +
+
+class pyams_zodbbrowser.state.PersistentMappingState(type, state, tid)
+

Bases: pyams_zodbbrowser.state.GenericState

+

Convenient access to a persistent mapping’s items.

+
+
+listItems()
+
+ +
+ +
+
+pyams_zodbbrowser.state.Provides(cls, *interfaces)
+
+ +
+
+class pyams_zodbbrowser.state.SampleContainerState(type, state, tid)
+

Bases: pyams_zodbbrowser.state.GenericState

+

Convenient access to a SampleContainer’s items

+
+
+listItems()
+
+ +
+ +
+
+class pyams_zodbbrowser.state.ZodbObjectState(obj, tid=None, _history=None)
+

Bases: object

+
+
+asDict()
+
+ +
+
+getError()
+
+ +
+
+getName()
+
+ +
+
+getObjectId()
+
+ +
+
+getParent()
+
+ +
+
+getParentState()
+
+ +
+
+isRoot()
+
+ +
+
+listAttributes()
+
+ +
+
+listItems()
+
+ +
+ +
+
+pyams_zodbbrowser.state.flatten_interfaces(args)
+
+ +
+
+pyams_zodbbrowser.state.install_provides_hack()
+

Monkey-patch zope.interface.Provides with a more lenient version.

+

A common result of missing modules in sys.path is that you cannot +unpickle objects that have been marked with directlyProvides() to +implement interfaces that aren’t currently available. Those interfaces +are replaced by persistent broken placeholders, which aren classes, +not interfaces, and aren’t iterable, causing TypeErrors during unpickling.

+
+ +
+
+

pyams_zodbbrowser.value module

+
+
+class pyams_zodbbrowser.value.DecoyPersistentDict(*args, **kwargs)
+

Bases: persistent.mapping.PersistentMapping

+

Decoy to avoid ZCML errors while supporting both ZODB 3.8 and 3.9.

+
+ +
+
+class pyams_zodbbrowser.value.DictValue(context)
+

Bases: object

+

Dict renderer.

+
+
+render(tid=None, can_link=True, threshold=100)
+
+ +
+ +
+
+class pyams_zodbbrowser.value.GenericValue(context)
+

Bases: object

+

Default value renderer.

+

Uses the object’s __repr__, truncating if too long.

+
+
+render(tid=None, can_link=True, limit=200)
+
+ +
+ +
+
+class pyams_zodbbrowser.value.ListValue(context)
+

Bases: object

+

List renderer.

+
+
+render(tid=None, can_link=True, threshold=100)
+
+ +
+ +
+
+class pyams_zodbbrowser.value.PersistentDictValue(context)
+

Bases: pyams_zodbbrowser.value.PersistentValue

+

Decoy to avoid ZCML errors while supporting both ZODB 3.8 and 3.9.

+
+
+delegate_to
+

alias of DictValue

+
+ +
+ +
+
+class pyams_zodbbrowser.value.PersistentListValue(context)
+

Bases: pyams_zodbbrowser.value.PersistentValue

+
+
+delegate_to
+

alias of ListValue

+
+ +
+ +
+
+class pyams_zodbbrowser.value.PersistentMappingValue(context)
+

Bases: pyams_zodbbrowser.value.PersistentValue

+
+
+delegate_to
+

alias of DictValue

+
+ +
+ +
+
+class pyams_zodbbrowser.value.PersistentValue(context)
+

Bases: object

+

Persistent object renderer.

+

Uses __repr__ and makes it a hyperlink to the actual object.

+
+
+delegate_to
+

alias of GenericValue

+
+ +
+
+render(tid=None, can_link=True)
+
+ +
+
+view_name = '#zodbbrowser'
+
+ +
+ +
+
+class pyams_zodbbrowser.value.ProvidesValue(context)
+

Bases: pyams_zodbbrowser.value.GenericValue

+

zope.interface.Provides object renderer.

+

The __repr__ of zope.interface.Provides is decidedly unhelpful.

+
+ +
+
+class pyams_zodbbrowser.value.StringValue(context)
+

Bases: pyams_zodbbrowser.value.GenericValue

+

String renderer.

+
+
+render(tid=None, can_link=True, limit=200, threshold=4)
+
+ +
+ +
+
+class pyams_zodbbrowser.value.TupleValue(context)
+

Bases: object

+

Tuple renderer.

+
+
+render(tid=None, can_link=True, threshold=100)
+
+ +
+ +
+
+pyams_zodbbrowser.value.join_with_commas(html, open, close)
+

Helper to join multiple html snippets into a struct.

+
+ +
+
+pyams_zodbbrowser.value.pruneTruncations()
+
+ +
+
+pyams_zodbbrowser.value.resetTruncations()
+
+ +
+
+pyams_zodbbrowser.value.truncate(text)
+
+ +
+
+

Module contents

+
+
+pyams_zodbbrowser.includeme(config)
+

Pyramid include

+
+ +
+
+ + +