2
votes

Running Plone 5.0.0

1. Registry Permission Issues

I'm doing something like the following for the retrieval:

registry = getUtility(IRegistry)
building_hours = registry['polklibrary.hours.cache']
return building_hours

Works great when logged in but for an anonymous user it return a None type. Doesn't throw an error. I'm kind of lost why? It might be because of #2.

2. The data in the registry is lost after I restart plone.

The hours type in #1 is a Dict type (which is allowed in the registry). However it is lost on a restart.

I've checked all these resources with no luck: https://pypi.python.org/pypi/plone.registry https://github.com/plone/plone.app.registry

(BTW, the Registry is awesome!)

Edit:

What saves the data: https://github.com/polklibrary/polklibrary.google.hours/blob/master/polklibrary.google.hours/src/polklibrary/google/hours/browser/cron.py

What reads the data: https://github.com/polklibrary/polklibrary.google.hours/blob/master/polklibrary.google.hours/src/polklibrary/google/hours/browser/feeds.py

1

1 Answers

8
votes

This is because dictionaries are not persistent. The Zope database does not realise that you have made a change to the dictionary. You need to give it a hint. The easiest way to do that, is to explicitly save the whole dictionary, in your case like this:

registry['polklibrary.google.hours.cache'] = registry['polklibrary.google.hours.cache']