| | 172 | def get_pref_dict(plugin_name): |
| | 173 | """ |
| | 174 | returns the data_dict for the given plugin_name. Used the cache. |
| | 175 | If a plugin use preferences in a newforms, it must have access to the |
| | 176 | preferences at module level. |
| | 177 | FIXME: If the admin change the preferences, the values in a plugin module |
| | 178 | level would only updated, if the server instance restarted. |
| | 179 | """ |
| | 180 | if plugin_name in preference_cache: |
| | 181 | return preference_cache[plugin_name] |
| | 182 | |
| | 183 | plugin = Plugin.objects.get(plugin_name=plugin_name) |
| | 184 | |
| | 185 | p = Preferences() |
| | 186 | p.set_plugin(plugin) |
| | 187 | p.load_from_db() |
| | 188 | return p.data_dict |
| | 189 | |