Kotti/Kotti — pull request #352 by disko (2014-11-24 19:16:28+00:00)
Title: New scaffold based on pcreate

This resolves #342.

Unfortunately this PR became much larger than intended. The scaffold itself was working well quite soon.

Most of the work went into making it testable in a solid way. During this one real bug with the public test fixtures and one major inconvenience came to light, both of which are fixed / resolved within this PR.

The bug had no effect before the introduction of the ``Node.path`` attribute with its special treatment for the index option on MySQL. This special treatment was executed in test runs when using the fixtures as intended, because it was part of ``kotti.resources.initialize_sql``. It has now been factored out into a new ``kotti.resources._adjust_for_engine`` function (https://github.com/disko/Kotti/commit/bfe42b32d047f344fb248a37aa06cbdf6f94035f#diff-090c6d6f97cd0028f14840e7b7f6aa94R733), that is called by both ``initialize_sql`` and the ``connection`` fixture (https://github.com/disko/Kotti/commit/bfe42b32d047f344fb248a37aa06cbdf6f94035f#diff-208cce8c3675137b809c98c6f6d289cdR86).

The inconvenience was caused by the settings fixture, because there was no way to reliably tell if it returned the _resolve_dotted settings or the "raw" settings with only strings. This could be resolved by making ``kotti._resolve_dotted`` returning a resolved **copy** of the settings (instead of modifying it in place). The result allows to have an additional ``unresolved_settings`` fixture and ``settings`` now being **always** resolved. As this might potentially have some unintended side effect, that is not caught by the tests, I request particular thorough review of this commit: https://github.com/disko/Kotti/commit/bfe42b32d047f344fb248a37aa06cbdf6f94035f

Additionally there's a new ``custom_settings`` fixture that returns an empty dict by default and s meant to be overridden by add ons' tests and allows for easy injection / overriding of arbitrary setting key / values. For an example see https://github.com/disko/Kotti/compare/feature/pcreate_scaffolds#diff-0cabf90cb756c471d153277f0ab108cbR13.