Commit 579bc9c9 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

support an empty selection_name, that means we do not store the selection.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@38248 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 10673188
...@@ -267,7 +267,7 @@ class ListBoxWidget(Widget.Widget): ...@@ -267,7 +267,7 @@ class ListBoxWidget(Widget.Widget):
description=('The name of the selection to ' description=('The name of the selection to '
'store selection parameters'), 'store selection parameters'),
default='', default='',
required=1) required=0)
property_names.append('selection_name') property_names.append('selection_name')
meta_types = fields.ListTextAreaField('meta_types', meta_types = fields.ListTextAreaField('meta_types',
...@@ -2425,13 +2425,16 @@ class ListBoxHTMLRendererLine(ListBoxRendererLine): ...@@ -2425,13 +2425,16 @@ class ListBoxHTMLRendererLine(ListBoxRendererLine):
error = sys.exc_info()) error = sys.exc_info())
else: else:
try: try:
url = '%s/view?selection_index=%s&selection_name=%s&ignore_layout:int=%s&reset:int=1' % ( url = '%s/view?ignore_layout:int=%s&reset:int=1' % (
# brain.absolute_url() is slow because it invokes # brain.absolute_url() is slow because it invokes
# _aq_dynamic() every time to get brain.REQUEST, # _aq_dynamic() every time to get brain.REQUEST,
# so we call request.physicalPathToURL() directly # so we call request.physicalPathToURL() directly
# instead of brain.absolute_url(). # instead of brain.absolute_url().
request.physicalPathToURL(brain.getPath()), request.physicalPathToURL(brain.getPath()),
self.index, selection_name, ignore_layout) ignore_layout)
if selection_name:
url += '&selection_index=%s&selection_name=%s' % (
self.index, selection_name)
except AttributeError: except AttributeError:
pass pass
......
...@@ -251,6 +251,8 @@ class SelectionTool( BaseTool, SimpleItem ): ...@@ -251,6 +251,8 @@ class SelectionTool( BaseTool, SimpleItem ):
""" """
if isinstance(selection_name, (tuple, list)): if isinstance(selection_name, (tuple, list)):
selection_name = selection_name[0] selection_name = selection_name[0]
if not selection_name:
return None
selection = self._getSelectionFromContainer(selection_name) selection = self._getSelectionFromContainer(selection_name)
if selection is not None: if selection is not None:
return selection.__of__(self) return selection.__of__(self)
...@@ -263,6 +265,8 @@ class SelectionTool( BaseTool, SimpleItem ): ...@@ -263,6 +265,8 @@ class SelectionTool( BaseTool, SimpleItem ):
""" """
Sets the selection instance for a given selection_name Sets the selection instance for a given selection_name
""" """
if not selection_name:
return
if selection_object != None: if selection_object != None:
# Set the name so that this selection itself can get its own name. # Set the name so that this selection itself can get its own name.
selection_object.edit(name=selection_name) selection_object.edit(name=selection_name)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment