Skip to content

Commit

Permalink
Merge pull request #5 from zopefoundation/flake8
Browse files Browse the repository at this point in the history
Flake8 the code.
  • Loading branch information
Michael Howitz committed Jun 8, 2017
2 parents 0d39da5 + cac2ea1 commit 05b0172
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Expand Up @@ -4,5 +4,5 @@ ignore =
bootstrap.py

[flake8]
ignore = N801,N802,N803,N805,N806,N812,E301
ignore = E301
exclude = bootstrap.py
6 changes: 2 additions & 4 deletions src/Products/PythonScripts/PythonScript.py
Expand Up @@ -20,18 +20,15 @@
import marshal
import os
import re
import six
from six.moves.urllib.parse import quote
import sys
import traceback
from types import FunctionType

from AccessControl.class_init import InitializeClass
from AccessControl.requestmethod import requestmethod
from AccessControl.SecurityInfo import ClassSecurityInfo
from AccessControl.SecurityManagement import getSecurityManager
from AccessControl.ZopeGuards import get_safe_globals, guarded_getattr
from AccessControl.ZopeGuards import get_safe_globals, guarded_getattr
from Acquisition import aq_parent
from App.Common import package_home
from App.Dialogs import MessageDialog
Expand Down Expand Up @@ -175,7 +172,7 @@ def ZPythonScriptHTML_upload(self, REQUEST, file=''):
if self.wl_isLocked():
raise ResourceLockedError("The script is locked via WebDAV.")

if not instance(file, str):
if not isinstance(file, str):
if not file:
raise ValueError('File not specified')
file = file.read()
Expand Down Expand Up @@ -549,6 +546,7 @@ def document_src(self, REQUEST=None, RESPONSE=None):
RESPONSE.setHeader('Content-Type', 'text/plain')
return self.read()


InitializeClass(PythonScript)


Expand Down
1 change: 1 addition & 0 deletions src/Products/PythonScripts/standard.py
Expand Up @@ -108,4 +108,5 @@ def __hash__(self):
def Object(**kw):
return _Object(**kw)


security.apply(globals())
1 change: 1 addition & 0 deletions src/Products/PythonScripts/tests/testBindings.py
Expand Up @@ -94,6 +94,7 @@ def __repr__(self):
def methodWithRoles(self):
return 'method called'


InitializeClass(FauxFolder)


Expand Down
9 changes: 8 additions & 1 deletion tox.ini
@@ -1,5 +1,6 @@
[tox]
envlist =
flake8,
py27,
py34,
py35,
Expand All @@ -8,9 +9,15 @@ envlist =
[testenv]
commands =
{envbindir}/buildout -c {toxinidir}/buildout.cfg buildout:directory={envdir} buildout:develop={toxinidir} bootstrap
{envbindir}/buildout -c {toxinidir}/buildout.cfg buildout:directory={envdir} buildout:develop={toxinidir} install test
{envbindir}/buildout -c {toxinidir}/buildout.cfg buildout:directory={envdir} buildout:develop={toxinidir} -n install test
{envbindir}/test
skip_install = true
deps =
setuptools==33.1.1
zc.buildout

[testenv:flake8]
basepython = python2.7
deps = flake8
skip_install = true
commands = flake8 --doctests src setup.py

0 comments on commit 05b0172

Please sign in to comment.