Beispiel #1
0
def about_group_preload(context, request):
    context = default_preload(context, request)
    query_args = url_params(request)
    group_id = query_args['id']
    group_json = GroupCache.get(group_id)
    if group_json is not None:
        context['title'] = group_json['group_name'] + ' | DemocracyLab'
        context['description'] = group_json['group_short_description']
        if 'group_thumbnail' in group_json:
            context['og_image'] = group_json['group_thumbnail']['publicUrl']
    else:
        print('Failed to preload group info, no cache entry found: ' + group_id)
    return context
Beispiel #2
0
 def recache(self):
     hydrated_group = self._hydrate_to_json()
     GroupCache.refresh(self, hydrated_group)
     ProjectSearchTagsCache.refresh(event=None, group=self)
Beispiel #3
0
 def hydrate_to_json(self):
     return GroupCache.get(self) or GroupCache.refresh(
         self, self._hydrate_to_json())