Skip to content

Commit

Permalink
Merge pull request #162 from plone/1801-get-from-paths
Browse files Browse the repository at this point in the history
Added get_objects_from_path_list
  • Loading branch information
jensens authored Oct 2, 2018
2 parents 1819ec7 + 111f1f5 commit 8b51c1d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ Breaking changes:

New features:

- *add item here*
- Added get_objects_from_path_list to replace skin script. #1801
[reinhardt]

Bug fixes:

Expand Down
9 changes: 9 additions & 0 deletions plone/app/content/browser/content_status_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,12 @@ def validate(self, workflow_action=None, paths=[]):
# Set paths using orgi_paths, otherwise users are getting confused
orig_paths = self.request.get('orig_paths')
self.request.set('paths', orig_paths)

def get_objects_from_path_list(self, paths=[]):
contents = []
portal = getToolByName(self.context, 'portal_url').getPortalObject()
for path in paths:
obj = portal.restrictedTraverse(str(path), None)
if obj is not None:
contents.append(obj)
return contents
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
tal:define="errors view/errors;
review_state context_state/workflow_state;
paths python:request.get('paths', ['/'.join(context.getPhysicalPath())]);
batch python:context.getObjectsFromPathList(paths, batch=False);
batch python:view.get_objects_from_path_list(paths);
folders_in_publishing python:[o.getId for o in batch if o.isPrincipiaFolderish];
came_from python:request.get('HTTP_REFERER', context.absolute_url()).split('?')[0];
dummy python:request.set('orig_template', came_from);
Expand Down

0 comments on commit 8b51c1d

Please sign in to comment.