Skip to content

Commit

Permalink
Stop using unicode_literals and fix RelStorage configuration on Pytho…
Browse files Browse the repository at this point in the history
…n 3. Fixes #8
  • Loading branch information
jamadden committed Nov 5, 2019
1 parent 4399f56 commit 70b11f8
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
8 changes: 8 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
=========
Changes
=========

1.0.0 (unreleased)
==================

- Fix relstorage recipe on Python 3. See `issue 8
<https://github.com/NextThought/nti.recipes.zodb/issues/8>`_.
10 changes: 5 additions & 5 deletions src/nti/recipes/zodb/relstorage.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
A meta-recipe to create multiple
relstorage connections in a Dataserver buildout.
.. $Id$
"""

from __future__ import print_function, unicode_literals, absolute_import, division
__docformat__ = "restructuredtext en"
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division

import textwrap

Expand Down Expand Up @@ -38,7 +38,7 @@ def __init__(self, buildout, name, options):
# in an environment is dangerous and can lead to data loss,
# it's slightly worse to assume shared when its not
if 'shared-blob-dir' not in options:
options['shared-blob-dir'] = b'false' # options must be strings
options['shared-blob-dir'] = 'false'
shared_blob_dir = options['shared-blob-dir']

cache_local_dir = ''
Expand All @@ -48,7 +48,7 @@ def __init__(self, buildout, name, options):
# to the installed.cfg while looking up the storage refs. We
# avoid taking any user-defined values since it might be
# confusing to have one (count limited) directory for all storages.
cache_local_dir = b'${deployment:cache-directory}/data_cache/${:name}.cache'
cache_local_dir = '${deployment:cache-directory}/data_cache/${:name}.cache'
cache_local_mb = options.get('cache-local-mb', '300')
cache_local_dir_count = options.get('cache-local-dir-count', '20')
blob_cache_size = options.get('blob-cache-size', '')
Expand Down
4 changes: 0 additions & 4 deletions src/nti/recipes/zodb/tests/test_relstorage.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ def test_parse(self):
{'storages': 'Users Users_1 Sessions',
'enable-persistent-cache': 'true'})

buildout.print_options()
assert_that(buildout['relstorages_users_storage']['client_zcml'],
contains_string('shared-blob-dir false'))

Expand Down Expand Up @@ -106,7 +105,6 @@ def test_parse(self):
'cache_servers': 'cache',
'enable-persistent-cache': 'true'})

buildout.print_options()
assert_that(buildout['relstorages_users_storage']['client_zcml'],
contains_string('shared-blob-dir false'))

Expand Down Expand Up @@ -150,7 +148,6 @@ def test_parse(self):
'sql_host': 'host',
'enable-persistent-cache': 'true'})

buildout.print_options()
assert_that(buildout['relstorages_users_storage']['client_zcml'],
is_not(contains_string('cache-servers')))

Expand All @@ -170,6 +167,5 @@ def test_parse(self):
{'storages': 'Users Users_1 Sessions',
'enable-persistent-cache': 'true'})

buildout.print_options()
assert_that(buildout['relstorages_users_storage']['client_zcml'],
is_not(contains_string('cache-servers')))
6 changes: 3 additions & 3 deletions src/nti/recipes/zodb/zeo.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
.. $Id$
"""

from __future__ import print_function, unicode_literals, absolute_import, division
__docformat__ = "restructuredtext en"
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division

logger = __import__('logging').getLogger(__name__)

Expand Down

0 comments on commit 70b11f8

Please sign in to comment.