Add timestamp to the template variables

Add index generation timestamp as a variable available to template
authors ("timestamp").

Change-Id: I7607f0c7eebaad1adca2d6e92a356a3dab1f015b
This commit is contained in:
Thierry Carrez 2015-05-28 15:45:35 +02:00
parent 74cb5acd5f
commit ff513f9efe
2 changed files with 5 additions and 1 deletions

View File

@ -16,3 +16,5 @@ Chair (to contact for more information): {{ meeting.chair }}</p>
{{ meeting.description|urlize }}
{% endfor %}
<p><i>Page generated on {{ timestamp }} UTC</i></p>

View File

@ -10,6 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import datetime
import jinja2
import logging
import os
@ -31,6 +32,7 @@ def convert_meetings_to_index(meetings, template, output_file):
template = env.get_template(template_file)
with open(output_file, "w") as out:
out.write(template.render(meetings=meetings))
out.write(template.render(meetings=meetings,
timestamp=datetime.datetime.utcnow()))
logging.info('Wrote %d meetings to index.' % (len(meetings)))