divio/django-cms — pull request #2776 by ojii (2014-03-02 10:58:00+00:00)
Title: Fixed all pyflake warnings, added pyflake test, added pyflake develop.py command

This pull request fixes all warnings caused by pyflake (while ignoring some). To ignore some of the warnings that can't be fixed (Py2/3 compat code for example) I had to write a ``cms.test_utils.util.static_analysis.pyflakes`` method which monkey patches pyflakes (unfortunately pyflakes doesn't allow custom checkers), which adds support for a ``# nopyflakes`` comment to ignore certain lines.

In the process I fixed at least three bugs:

* The uninstall plugins command asked for confirmation in interactive mode, but never checked the answer of the user
* In ``cms.utils.permission.has_page_add_permission`` there was an undefined local variable ``site``, which triggers an error if the request has a ``target`` parameter.
* In ``cms.models.placeholdermodel`` the builtin ``reduce`` was used, which is no longer available in Python 3.

Doing this cleanup I once again thought about how we handle ``cms/tests/__init__.py``. At least once in the past some tests were **not** run because they had the same class name as used in a different package. Therefore I'd suggest we remove the ``from x import *`` imports with explicit imports for every single class. This would be a different PR though.