Hello,
I understand that, but what do we win by using it? As you have noticed by now I am not very fond of using templates for everything, and I believe this is one of the things that we can skip templates.
We might even shift this to a frontend concern and if we want there are node libraries to get gravatars.
I was able to create a PoC as a sample of what I was talking about:
- Add gravatar library to package.json
- Created a Preferences cache. (js/preferences.js)
- So this was the concept I was talking about in a previous email we talked about caching.
the getConfiguration and the getAllConfiguration are not great names, but they return a Promise that is consumed in the load_gravatar. The idea here is that we are caching the pgAdmin settings and when need need to consume them, we wait for it to be available.
- load_gravatar is using the pattern to retrieve the configuration from a possible cache and then apply the gravatar
Things that need to be revisited in the PoC:
- No tests, just some spiked code
- Did not retrieve the username from the backend, we need to create an endpoint that give us this
- The url is hardcoded to get the configuration
- Maybe the Preferences is not the correct place to get server_mode configuration not sure, what do you think?
Hi Joao,
We are using
Flask-Gravatar module for this and it is designed to work with template only.