Dynamic Vocabularies running on 'view' of a object

I don't want to go down a rabbit hole just yet, so I'm just going to ask.

I got one of these things: A IContextSourceBinder https://docs.plone.org/external/plone.app.dexterity/docs/advanced/vocabularies.html#dynamic-sources

And, as far as I know, it's all simply wired up. The only thing a bit different is the field that uses the vocabulary is in a behavior.

Is there any reason why an anonymous view of an object would call the vocabulary constructor?

Maybe we have some stray code that manually calls the vocabulary, I haven't looked for it yet.

All I know at this point is that my vocabulary function - used for one field, (in a behavior, btw) is being called 3 times each page view, and it's slightly annoying.


Wait - I think I know what I did wrong... now that I wrote this out... but still asking this basic question.

I have some weird ajaxy calls to grab json views of the vocabulary to make a fancy edit page. I think this javascript may be getting included and run on view templates also... That's the likely culprit.


Nope, that ajaxy javascript isn't included on the view, only on the edit (formgen-ed) pages. So this doesn't explain why the vocabulary builder is called on view.

"Well me, it's nice talking to myself
A credit to dementia"

1 Like

What works for me is explaining the issue to my non-technical boss. I often catch the problem midway through... :sunglasses:

1 Like

Or googling it and discover that I answered the same question some time ago :slight_smile:

2 Likes

I actually solved a weird issue this week explaining it to my wife. My import script wasn't changing things in the UI.

Turns out, while refreshing the webpage (ui) I was re-submitting post requests to delete what I had just successfully imported. :man_facepalming:

I felt very embarrassed and she was quite proud to be helpful.

Yeah, you know that little box that pops up on most browsers asking "Please confirm form resubmission" when you refresh? Yeah. I should stop ignoring those.

On this site.

Yes… When I have a problem, I search on this site, and find that I once knew the answer (but have forgotten now).