Skip to content

Commit

Permalink
Merge pull request #140 from plone/139.bugfix
Browse files Browse the repository at this point in the history
Fix flake8
  • Loading branch information
mauritsvanrees authored Jun 27, 2020
2 parents 9729eae + d573d76 commit d9b4c2e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
1 change: 1 addition & 0 deletions news/139.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix flake8 [ale-rt]
8 changes: 4 additions & 4 deletions src/plone/recipe/zope2instance/recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def build_zope_conf(self):
chameleon_cache = 'CHAMELEON_CACHE {}'.format(chameleon_cache)
if environment_vars and '\n' in environment_vars:
# default case
environment_vars += '\n'.format(chameleon_cache)
environment_vars += '\n{}'.format(chameleon_cache)
elif environment_vars:
# handle case of all vars in one line
environment_vars += ' {}'.format(chameleon_cache)
Expand Down Expand Up @@ -717,9 +717,9 @@ def is_rs_option(name):
enable_products=enable_products,
zope_conf_additional=zope_conf_additional,)

zope_conf = '\n'.join([l
for l in zope_conf.splitlines()
if l.rstrip()])
zope_conf = "\n".join(
[line for line in zope_conf.splitlines() if line.rstrip()]
)
zope_conf_path = os.path.join(location, 'etc', 'zope.conf')
with open(zope_conf_path, 'w') as f:
f.write(zope_conf)
Expand Down
7 changes: 5 additions & 2 deletions src/plone/recipe/zope2instance/tests/zope2instance.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1445,8 +1445,11 @@ Our environment variables should be set now::
>>> zope_conf = zope_conf.replace('\\', '/')
>>> import re
>>> env_vars = re.compile(r"<environment>\n\s*(?P<vars>.*)\n</environment>", re.M | re.S)
>>> re.search(env_vars, zope_conf).group('vars')
'TZ US/Eastern\nTMP /var/tmp\nDISABLE_PTS True'
>>> print(re.search(env_vars, zope_conf).group('vars'))
TZ US/Eastern
TMP /var/tmp
DISABLE_PTS True
CHAMELEON_CACHE .../var/cache

Several all on one line::

Expand Down
12 changes: 8 additions & 4 deletions src/plone/recipe/zope2instance/tests/zope2instance_zserver.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1737,8 +1737,10 @@ Our environment variables should be set now::
>>> zope_conf = zope_conf.replace('\\', '/')
>>> import re
>>> env_vars = re.compile(r"<environment>\n\s*(?P<vars>.*)\n</environment>", re.M | re.S)
>>> re.search(env_vars, zope_conf).group('vars')
'TZ US/Eastern\nTMP /var/tmp\nDISABLE_PTS True'
>>> print(re.search(env_vars, zope_conf).group('vars'))
TZ US/Eastern
TMP /var/tmp
DISABLE_PTS True

Several all on one line::

Expand Down Expand Up @@ -1770,8 +1772,10 @@ Our environment variables should be set now::
>>> instance = os.path.join(sample_buildout, 'parts', 'instance')
>>> zope_conf = open(os.path.join(instance, 'etc', 'zope.conf')).read()
>>> zope_conf = zope_conf.replace('\\', '/')
>>> re.search(env_vars, zope_conf).group('vars')
'TZ US/Eastern\nTMP /var/tmp\nDISABLE_PTS True'
>>> print(re.search(env_vars, zope_conf).group('vars'))
TZ US/Eastern
TMP /var/tmp
DISABLE_PTS True


HTTP server
Expand Down

0 comments on commit d9b4c2e

Please sign in to comment.