pyams_zodbbrowser package ⊞

pyams_zodbbrowser.includeme(config)[source]

Pyramid include

pyams_zodbbrowser.btreesupport

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)[source]

Bases: pyams_zodbbrowser.state.GenericState

Convenient access to a BTreeContainer’s items

listItems()[source]
class pyams_zodbbrowser.btreesupport.EmptyOOBTreeState(type, state, tid)[source]

Bases: pyams_zodbbrowser.btreesupport.OOBTreeState

Empty OOBTrees pickle to None.

class pyams_zodbbrowser.btreesupport.FolderState(type, state, tid)[source]

Bases: pyams_zodbbrowser.state.GenericState

Convenient access to a Folder’s items

listItems()[source]
class pyams_zodbbrowser.btreesupport.OOBTreeHistory(obj)[source]

Bases: pyams_zodbbrowser.history.ZodbObjectHistory

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

Bases: object

Non-empty OOBTrees have a complicated tuple structure.

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

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()[source]
getError()[source]
getName()[source]
getParent()[source]
listAttributes()[source]
listItems()[source]

pyams_zodbbrowser.cache

pyams_zodbbrowser.cache.expired(cache_dict, cache_for)[source]
pyams_zodbbrowser.cache.getStorageTids(storage, cache_for=300)[source]

pyams_zodbbrowser.diff

pyams_zodbbrowser.diff.compareDicts(new, old)[source]

Compare two state dictionaries, return dict.

pyams_zodbbrowser.diff.compareDictsHTML(new, old, tid=None, indent='')[source]

Compare two state dictionaries, return HTML.

pyams_zodbbrowser.diff.compareTuples(new, old)[source]

Compare two tuples.

Return (common_prefix, middle_of_old, middle_of_new, common_suffix)

pyams_zodbbrowser.diff.compareTuplesHTML(new, old, tid=None, indent='')[source]

Compare two tuples, return HTML.

pyams_zodbbrowser.diff.isascii(s)[source]

See if the string can be safely converted to unicode.

pyams_zodbbrowser.history

class pyams_zodbbrowser.history.ZodbHistory(connection)[source]

Bases: object

tids
class pyams_zodbbrowser.history.ZodbObjectHistory(obj)[source]

Bases: object

lastChange(tid=None)[source]
loadState(tid=None)[source]
loadStatePickle(tid=None)[source]
rollback(tid)[source]

pyams_zodbbrowser.state

class pyams_zodbbrowser.state.ContainedProxyState(proxy, state, tid)[source]

Bases: pyams_zodbbrowser.state.GenericState

asDict()[source]
getName()[source]
getParent()[source]
listAttributes()[source]
listItems()[source]
class pyams_zodbbrowser.state.DecoyPersistentDict(**kwargs)[source]

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)[source]

Bases: object

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

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

Bases: object

Most persistent objects represent their state as a dict.

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

Bases: object

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

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

Bases: pyams_zodbbrowser.state.GenericState

Convenient access to an OrderedContainer’s items

listItems()[source]
class pyams_zodbbrowser.state.PersistentDictState(type, state, tid)[source]

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)[source]

Bases: pyams_zodbbrowser.state.GenericState

Convenient access to a persistent mapping’s items.

listItems()[source]
pyams_zodbbrowser.state.Provides(cls, *interfaces)[source]
class pyams_zodbbrowser.state.SampleContainerState(type, state, tid)[source]

Bases: pyams_zodbbrowser.state.GenericState

Convenient access to a SampleContainer’s items

listItems()[source]
class pyams_zodbbrowser.state.ZodbObjectState(obj, tid=None, _history=None)[source]

Bases: object

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

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

class pyams_zodbbrowser.value.DecoyPersistentDict(**kwargs)[source]

Bases: persistent.mapping.PersistentMapping

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

class pyams_zodbbrowser.value.DictValue(context)[source]

Bases: object

Dict renderer.

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

Bases: object

Default value renderer.

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

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

Bases: object

List renderer.

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

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)[source]

Bases: pyams_zodbbrowser.value.PersistentValue

delegate_to

alias of ListValue

class pyams_zodbbrowser.value.PersistentMappingValue(context)[source]

Bases: pyams_zodbbrowser.value.PersistentValue

delegate_to

alias of DictValue

class pyams_zodbbrowser.value.PersistentValue(context)[source]

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)[source]
view_name = '#zodbbrowser'
class pyams_zodbbrowser.value.ProvidesValue(context)[source]

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)[source]

Bases: pyams_zodbbrowser.value.GenericValue

String renderer.

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

Bases: object

Tuple renderer.

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

Helper to join multiple html snippets into a struct.

pyams_zodbbrowser.value.pruneTruncations()[source]
pyams_zodbbrowser.value.resetTruncations()[source]
pyams_zodbbrowser.value.truncate(text)[source]