def _prefill_draft(obj, eng): if not getattr(request, 'is_api_request', False): draft_cache = DepositionDraftCacheManager.get() if draft_cache.has_data(): d = Deposition(obj) draft_cache.fill_draft(d, draft_id, clear=clear) d.update()
def index_context_listener(sender, context=None): """ Add extra variables into deposit index template to create """ if context: context['form'] = UploadForm() context['deposition_type'] = None if 'c' in request.values: try: from invenio.modules.communities.models import Community c = Community.query.get(request.values.get('c')) draft_cache = DepositionDraftCacheManager.get() draft_cache.data['communities'] = [ { 'identifier': c.id, 'title': c.title, }, ] del draft_cache.data['c'] draft_cache.save() context['community'] = c except Exception: context['community'] = None except ImportError: # Community module not installed pass
def index_context_listener(sender, context=None): """ Add extra variables into deposit index template to create """ if context: context['form'] = UploadForm() context['deposition_type'] = None if 'c' in request.values: try: from invenio.modules.communities.models import Community c = Community.query.get(request.values.get('c')) draft_cache = DepositionDraftCacheManager.get() draft_cache.data['communities'] = [{ 'identifier': c.id, 'title': c.title, }, ] del draft_cache.data['c'] draft_cache.save() context['community'] = c except Exception: context['community'] = None except ImportError: # Community module not installed pass