Move over new code merged into the old DataValues repository

Changes by Henning Snater

Original commits:

* https://gerrit.wikimedia.org/r/#/c/101876/7
* https://gerrit.wikimedia.org/r/#/c/102089/3

Some minor changes where made in the bootstrapping code to
have the code work when loaded on an alterate location.
Merge pull request #2 from wmde/port

Move over new code merged into the old DataValues repository