Skip to content

Commit

Permalink
fix GS export/import in python3
Browse files Browse the repository at this point in the history
  • Loading branch information
erral committed Jun 18, 2019
1 parent f95ab38 commit 02f918c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Expand Up @@ -4,6 +4,9 @@ Changes
2.0.0 (unreleased)
------------------

- Fix GenericSetup import/export in python3
[erral]

- Use taxonomy default language for indexing if current language is not available
[agitator]

Expand Down
12 changes: 3 additions & 9 deletions src/collective/taxonomy/exportimport.py
Expand Up @@ -92,26 +92,20 @@ def exportTaxonomy(context):
for name in ['title', 'description', 'default_language']:
value = getattr(taxonomy, name, None)
if value:
if isinstance(value, six.string_types):
config.set('taxonomy', name, value.encode('utf-8'))
else:
config.set('taxonomy', name, value)
config.set('taxonomy', name, six.ensure_text(value))

for name in ['field_title', 'field_description',
'write_permission', 'taxonomy_fieldset']:
value = getattr(behavior, name, None)
if value:
if isinstance(value, six.string_types):
config.set('taxonomy', name, value.encode('utf-8'))
else:
config.set('taxonomy', name, value)
config.set('taxonomy', name, six.ensure_text(value))

for name in ['is_single_select', 'is_required']:
value = getattr(behavior, name, None)
if value:
config.set('taxonomy', name, str(value).lower())

filehandle = BytesIO()
filehandle = StringIO()
config.write(filehandle)
context.writeDataFile('taxonomies/' + short_name + '.cfg',
filehandle.getvalue(), 'text/plain')
Expand Down

0 comments on commit 02f918c

Please sign in to comment.