Help with plone.api.content.get_view

Good morning,

I'm trying (without success) to make plone.api.content.get_view work with one test in this buildout https://github.com/collective/collective.glossary can someone help me please?

Hi

The actual error is in https://github.com/collective/collective.glossary/blob/master/src/collective/glossary/browser/views.py#L48 .
The 'Title' is probably empty, thus 'Title[0]' raises an IndexError.

The solution to this is to rename your method 'populate' to 'items'. Using 'view/items' will call the method automatically for you.

I've filed a bug report at https://github.com/plone/plone.api/issues/230 .

Cheers,
Roel

Thank you very much for your help @jaroel

I'll try it right now!

You are right @jaroel the problem was with one brain.Title[0] code I used.. but I filled the object with obj.setTitle('something') and into my tests it didn't fill the Title attribute of the brain, just the object..

Do that should be another bug report?

my bad.. @hvelarde pointed me that I should use obj.reindexObject to fill the brain attributes

in fact, you should reindex the object to update the catalog; an updated catalog will result in updated brains :slight_smile: