stephenmcd/mezzanine — pull request #823 by AlexHill (2013-11-21 10:34:37+00:00)
Title: Assume settings pulled from the database are UTF-8.

External apps (like Cartridge) that use Mezzanine's settings machinery but haven't been run through the same Python 3 conversion process as Mezzanine have a settings problem under Python 2.

When Cartridge registers its settings, their textual defaults are bytes in Python 2, and are detected as such by Mezzanine's settings system. Django pulls Unicode out of the database, and so a TypeError is thrown when we try to instantiate ``future``'s ``newbytes`` type from that Unicode without passing an ``encoding`` argument.

The change replaces the newbytes type with a partial which passes in utf-8 as the encoding - I'm not sure if this change will break anything so this is more for discussion at this stage, but this illustrates the problem and how it could potentially be fixed. Tests pass though.

(As an aside, I don't think updating the codebase to support Python 3 should cause existing external apps to break like this, especially running under Python 2 - those cases should be considered bugs. We can update Cartridge easily, but not whatever third-party code might be out there using Mezzanine's settings stuff. Thoughts?)