travis: apache config

Signed-off-by: Jiri Kuncar <jiri.kuncar@cern.ch>
WebSession: reporting errors in *_user_settings.py

* Errors in `*_user_settings.py` files are logged in
  `CFG_LOGDIR/broken-user-settings.log`.  (closes #1570)

Co-authored-by: Jiri Kuncar <jiri.kuncar@cern.ch>
WebStyle: error code 401 on authorization failure

* Adds error code 401 when user is not authorized instead of just
  flashing an error message with a success code.

* Uses same `unauthorized` handler in Flask `login_manager` as 401 error
  handler.

* Fixes webstyle regression tests.

Signed-off-by: Jiri Kuncar <jiri.kuncar@cern.ch>
Co-authored-by: Konstantinos Ntemagkos <konstantinos.ntemagkos@cern.ch>
hashutils: initial release

Signed-off-by: Jiri Kuncar <jiri.kuncar@cern.ch>
hashutils: usage update in modules

Signed-off-by: Jiri Kuncar <jiri.kuncar@cern.ch>
WebAPIKey: initial Flask port

* Moves `web_api_key` logic to the model.

* Refactors functions to work with sqlalchemy and flask request.

* Refactors `web_api_key` to work with model functions.

* Updates `web_api_key_regression_tests`.

Signed-off-by: Konstantinos Ntemagkos <konstantinos.ntemagkos@cern.ch>
Reviewed-by: Jiri Kuncar <jiri.kuncar@cern.ch>
mailutils: Flask-Email initial port

* Adds new configuration variable CFG_MAIL_BACKEND.  (closes #1531)

* Adds html and plaintext email templates.

* Adds unit tests for sending emails.

* Adds `mailtutils_backend_adminonly` for sending emails only to
  CFG_SITE_ADMIN_EMAIL.

Signed-off-by: Jiri Kuncar <jiri.kuncar@cern.ch>
installation: jinja2utils and requirements upgrade

* Upgrades python dependencies to latest versions and fixes
  compatibility issues with Jinja2/MarkupSafe packages.
  (addresses #1476)

* NOTE run `pip install -r requirements-flask.txt --upgrade` and
  `pip install -r requirements-flask-ext.txt --upgrade`. You might need
  to clean pip cache and build directories
  (`rm -rf ~/.pip/cache/* ~/.pip/build/*`).

Signed-off-by: Jiri Kuncar <jiri.kuncar@cern.ch>
BibWorkflow: workflow query API initial release

Reviewed-by: Jiri Kuncar <jiri.kuncar@cern.ch>
inveniomanage: cache, bibrecord and runserver cmds

* Adds `cache` manager for reseting all record structure caches.

* Adds `bibrecord` manager for reseting `recstruct` caches.

* Adds expunge command to `bibformat` manager that removes
  static formats from bibfmt cache.  (addresses #1549)

* Uses host and port from config variable CFG_SITE_URL as default for
  `runserver` command.

Signed-off-by: Jiri Kuncar <jiri.kuncar@cern.ch>
Co-authored-by: Esteban J. G. Gabancho <esteban.gabancho@cern.ch>
WebSearch: CollectionExample demosite fixture fix

Signed-off-by: Jiri Kuncar <jiri.kuncar@cern.ch>
WebStyle: authorized decorator fix

* Addresses issues with authorized code different from 0 and 1.

Signed-off-by: Jiri Kuncar <jiri.kuncar@cern.ch>
installation: mysql default date value fix

* Fixes problem while installing Invenio using fixtures where some dates
  were set with year=1, which is not accepted by mysql and this made the
  installation crash. Now, they are set to 1900 which is the lowest
  value accepted by MySQL.

Signed-off-by: Alberto Rodriguez Peon <alberto.rodriguez.peon@cern.ch>
Signed-off-by: Jiri Kuncar <jiri.kuncar@cern.ch>
WebSearch: record usage tab fix

* Fixes `rnkDOWNLOADS` and `rnkPAGEVIEWS` logging.

Signed-off-by: Jaime García <jaime.garcia.llopis@cern.ch>
Co-authored-by: Jiri Kuncar <jiri.kuncar@cern.ch>
datastructures: lazy dictionaries addition

* Adds two types of lazy dictionaries that load their content only when
  is needed or accessed for the first time.

Signed-off-by: Esteban J. G. Gabancho <esteban.gabancho@cern.ch>
Co-authored-by: Jiri Kuncar <jiri.kuncar@cern.ch>
jinja2utils: functions and filter to context

* Like for bfe_* it allows the admin user to add new functions,
  `template_context_functions` (tfn), to display content within
  a jinja template.

* Adds the possibility to create new filters
  `template_context_filters` (tfi).

Signed-off-by: Esteban J. G. Gabancho <esteban.gabancho@cern.ch>
Co-authored-by: Jiri Kuncar <jiri.kuncar@cern.ch>
BibField: laziest reader loading

* Improves lazy loading of bibfield readers using `LaziestDict`.

* Improves lazy loading of bibfield functions and field type checks.

* Addresses issue with missing application context regresion tests.

Signed-off-by: Jiri Kuncar <jiri.kuncar@cern.ch>