plone - Brain attributes and ipdb autocomplete -


why ipdb session don't show every attribute of brain autocomplete? example brain.uid exists not listed on ipdb autocomplete. black magic on brain code?

with ipdb can autocomplete attributes of brain:

>>> dir(brain) ['__add__', '__allow_access_to_unprotected_subobjects__', '__class__', '__cmp__', '__contains__', '__delattr__', '__delitem__', '__delslice__', '__dict__', '__doc__', '__format__', '__getattribute__', '__getitem__', '__getslice__', '__getstate__', '__hash__', '__implemented__', '__init__', '__len__', '__module__', '__mul__', '__new__', '__of__', '__providedby__', '__provides__', '__record_schema__', '__reduce__', '__reduce_ex__', '__repr__', '__rmul__', '__setattr__', '__setitem__', '__setslice__', '__setstate__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_unrestrictedgetobject', 'getobject', 'getpath', 'getrid', 'geturl', 'has_key'] 

the metadata of brain not directly stored on "brain". stored in btree (dataattribute) on catalog. can access informations stored in data storage through brain.

so if try access attribute doesn't exist on brain try return value metadata storage if key available, otherwise attributeerroris raised.

the magic happens somewhere here (zcatalog).

also check line 77:

# catalog maintains btree of object meta_data convenient display on result pages. meta_data attributes turned brain objects , returned searchresults.

in zmi on portal_catalog tool, there' metadata tab, shows accessible metadata infos.

update:

playing around catalog:

>>> plone = app.plone >>> catalog = plone.portal_catalog >>> _catalog = catalog._catalog >>> brain = catalog()[0]  # metadata stored in data btree, key rid of brain. >>> rid = brain.getrid() >>> rid 704953343  >>> _catalog.data <btrees.iobtree.iobtree object @ 0x10b158150>  >>> _catalog.data[rid] # uid part of tuple. ('2015-07-22t09:27:09+02:00', 'admin', '2015-07-22t15:12:07+02:00', '', 'none', 'none', '2015-07-22t15:12:07+02:00', (), 'xxx', u'xxx', '38e87a4b80704681b60781b66d37346c', datetime('2015/07/22 09:27:9.236886 gmt+2'), datetime('1969/12/31 00:00:00 gmt+2'), missing.value, missing.value, datetime('2499/12/31 00:00:00 gmt+2'), '', 'xxx', '0 kb', missing.value, 'xxx', true, ('admin',), missing.value, 'dexterity container', datetime('2015/07/22 15:12:7.787001 gmt+2'), 'xxx', missing.value, missing.value, missing.value, 0, none, (), missing.value, missing.value, missing.value, missing.value) 

Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -