base: PEP8 and PEP257 clean-up in factory

Signed-off-by: Jiri Kuncar <jiri.kuncar@cern.ch>
base: fix for wsgi PATH_INFO handling

* Addresses issue with url encoded arguments in Flask routes. E.g. for
  route `/collection/<name>` the view argument `name` was not unescaped
  when accessed by `/collection/Books%20%26%20Reports` on Apache and
  this led to error during lookup in database.  (closes #1823)

Reported-by: Petr Broz <petr.broz@gmail.com>
Signed-off-by: Jiri Kuncar <jiri.kuncar@cern.ch>