geo-data / medin-portal

Implementation of the MEDIN portal
http://portal.oceannet.org
3 stars 1 forks source link

Handle template errors caused by dates pre 1900 #32

Closed homme closed 11 years ago

homme commented 11 years ago

Example: http://portal.oceannet.org/search/full/catalogue/grid.bodc.nerc.ac.uk__MEDIN_2.3__EDMED196.xml at 2012-08-01 18:54:44,764

Example traceback is as follows:

The application encountered an unhandled exception
File /data/www/medin_portal/python/errata.py, line 58, in __call__
return self.app(environ, start_response)
File /data/www/medin_portal/python/selector.py, line 161, in __call__
return app(environ, start_response)
File /data/www/medin_portal/python/medin/__init__.py, line 341, in __call__
return app(environ, start_response)
File /data/www/medin_portal/python/medin/__init__.py, line 257, in __call__
return self.app(environ, start_response)
File /data/www/medin_portal/python/mediator.py, line 81, in __call__
return handler(environ, check_response)
File /data/www/medin_portal/python/medin/__init__.py, line 309, in wrapper
return app(environ, wrapped_response)
File /data/www/medin_portal/python/medin/views.py, line 1230, in __call__
return self.app(environ, start_response)
File /data/www/medin_portal/python/medin/templates.py, line 122, in __call__
output = template.render(**kwargs)
File /data/www/medin_portal/python/mako/template.py, line 133, in render
return runtime._render(self, self.callable_, args, data)
File /data/www/medin_portal/python/mako/runtime.py, line 364, in _render
_render_context(template, callable_, context, *args, **_kwargs_for_callable(callable_, data))
File /data/www/medin_portal/python/mako/runtime.py, line 381, in _render_context
_exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
File /data/www/medin_portal/python/mako/runtime.py, line 414, in _exec_template
callable_(context, *args, **kwargs)
File /data/www/medin_portal/templates/full/base.html, line 133, in render_body
          ${next.body()}
File /data/www/medin_portal/python/mako/runtime.py, line 255, in <lambda>
return lambda *args, **kwargs:callable_(self.context, *args, **kwargs)
File /data/www/medin_portal/templates/full/base-ok.html, line 37, in render_body
${next.body()}
File /data/www/medin_portal/python/mako/runtime.py, line 255, in <lambda>
return lambda *args, **kwargs:callable_(self.context, *args, **kwargs)
File /data/www/medin_portal/templates/full/metadata.html, line 811, in render_body
        <%self:output_element element="${metadata.temporal_reference}" number="${16}">
File /data/www/medin_portal/python/mako/runtime.py, line 255, in <lambda>
return lambda *args, **kwargs:callable_(self.context, *args, **kwargs)
File /data/www/medin_portal/templates/full/metadata.html, line 107, in render_output_element
  % endif
File /data/www/medin_portal/templates/full/metadata.html, line 820, in body
        <div class="sibling">
File /data/www/medin_portal/templates/full/metadata.html, line 804, in format_date
        <p>It is recommended that all known temporal references of the
File /data/www/medin_portal/templates/full/metadata.html, line 66, in render_format_date
${date.strftime('%Y')}\
ERROR: ValueError: year=1890 is before 1900; the datetime strftime() methods require year >= 1900
homme commented 11 years ago

Fixed in commit 2b45aec.