Skip to content

Commit

Permalink
ix export of defaultPage and layout. Before, always the defaultPage w…
Browse files Browse the repository at this point in the history
…as set now layout is always set and defaultPage only, if there is one defined.
  • Loading branch information
thet committed Mar 3, 2015
1 parent 2923456 commit cd9ffba
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Changelog
0.3 (unreleased)
----------------

- Fix export of defaultPage and layout. Before, always the defaultPage was set
now layout is always set and defaultPage only, if there is one defined.
[thet]

- Handle plone.formwidget.geolocation Dexterity field types.
[thet]

Expand Down
2 changes: 1 addition & 1 deletion collective/jsonify/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def export_content(self,
if BATCH_START is not None:
count_sub = BATCH_START
msg = 'SUCCESS :: exported %s items from %s' % (
COUNTER - count_sub,
COUNTER - count_sub - 1,
self.absolute_url()
)
if BATCH_START is not None:
Expand Down
30 changes: 18 additions & 12 deletions collective/jsonify/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,20 +451,26 @@ def get_defaultview(self):
except:
pass

_default = ''
try:
_browser = '/'.join(
self.portal_utils.browserDefault(
self.context)[1])
if _browser not in ['folder_listing', 'index_html']:
self['_layout'] = ''
self['_defaultpage'] = _browser
_default = '/'.join(
self.portal_utils.browserDefault(self.context)[1])
except AttributeError:
try:
_browser = self.context.getLayout()
self['_layout'] = _browser
except:
pass
self['_defaultpage'] = ''
pass

_layout = ''
try:
_layout = self.context.getLayout()
except:
pass

if _default and _layout and _default == _layout:
# browserDefault always returns the layout, but we only want to set
# the defaultpage, if it's different from the layout
_default = ''

self['_defaultpage'] = _default
self['_layout'] = _layout

def get_format(self):
"""Format of object
Expand Down

0 comments on commit cd9ffba

Please sign in to comment.