#985: BibFormat: lazy record formatting
------------------------+------------------------
Reporter: simko | Owner:
Type: enhancement | Status: new
Priority: major | Component: BibFormat
Version: | Resolution:
Keywords: |
------------------------+------------------------
Comment (by jcaffaro):
Replying to [ticket:985 simko]:
> In the future it could store even parts of the formats in case some
elements are dynamic and depend upon logged-in user credentials.
One of the possibilities that had been explored was the addition of a new
(optional) function '{{{on_the_fly(bfo)}}}' to bibformat element files
(similarly to '{{{escape_values(bfo)}}}') to let developers decide if an
element should absolutely never be cached, but executed at runtime:
{{{
def format_element(bfo):
return bfo.user_info['nickname']
def escape_values(bfo):
return 1
def on_the_fly(bfo):
"This element is executed dynamically for logged in users"
if bfo.user_info['guest']:
return True
else:
return False
}}}
It should also be possible from format templates to decide to execute an
element dynamically or not:
{{{
<BFE_TITLE prefix="<h1>" suffix="</h1>" />
<BFE_ABSTRACT on_the_fly="True" />
}}}
BibFormat could still cache a pre-prepared output, leaving untouched the
format element tags to be executed at run-time:
{{{
<h1>My Title</h1>
<BFE_ABSTRACT on_the_fly="True" />
}}}
Caches that should be preprocessed at runtime could be marked in some
"on_the_fly" column of the "fmtCACHE" table.
--
Ticket URL: <http://invenio-software.org/ticket/985#comment:2>
Invenio <http://invenio-software.org>