Commit d855e4bc authored by Alexandre Boeglin's avatar Alexandre Boeglin

Added 'Jump Allowed' parameter that hides the jump clickable link and plane.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3228 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 75ba0c70
......@@ -80,7 +80,7 @@ class MultiRelationStringFieldWidget(Widget.LinesTextAreaWidget, RelationField.R
_v_property_name_list.append(property_name)
_v_dict[property_name] = 1
property_names = _v_property_name_list
def render(self, field, key, value, REQUEST):
"""
......@@ -104,32 +104,32 @@ class MultiRelationStringFieldWidget(Widget.LinesTextAreaWidget, RelationField.R
need_validation = 0
# Check all relation
for i in range( len(value_list) ):
relation_field_id = 'relation_%s_%s' % ( key, i )
relation_item_id = 'item_%s_%s' % ( key, i )
relation_field_id = 'relation_%s_%s' % ( key, i )
relation_item_id = 'item_%s_%s' % ( key, i )
if REQUEST.has_key(relation_item_id) and value_list[i] != '':
need_validation = 1
break
html_string = ''
if need_validation:
# Check all relation
for i in range( len(value_list) ):
value = value_list[i]
relation_field_id = 'relation_%s_%s' % ( key, i )
relation_item_id = 'item_%s_%s' % ( key, i )
relation_field_id = 'relation_%s_%s' % ( key, i )
relation_item_id = 'item_%s_%s' % ( key, i )
# If we get a empty string, display nothing !
if value == '':
pass
else:
html_string += Widget.TextWidget.render(self, field, key, value, REQUEST)
if REQUEST.has_key(relation_item_id):
relation_item_list = REQUEST.get(relation_item_id)
if relation_item_list != []:
# Define default tales on the fly
tales_expr = field.tales.get('items', None)
......@@ -140,10 +140,10 @@ class MultiRelationStringFieldWidget(Widget.LinesTextAreaWidget, RelationField.R
field.tales['items'] = TALESMethod('REQUEST/relation_item_list')
REQUEST['relation_item_list'] = relation_item_list
html_string += ' %s ' % Widget.ListWidget.render(self,
field, relation_field_id, None, REQUEST)
REQUEST['relation_item_list'] = None
REQUEST['relation_item_list'] = relation_item_list
html_string += ' %s ' % Widget.ListWidget.render(self,
field, relation_field_id, None, REQUEST)
REQUEST['relation_item_list'] = None
if defined_tales:
# Delete default tales on the fly
......@@ -162,7 +162,7 @@ class MultiRelationStringFieldWidget(Widget.LinesTextAreaWidget, RelationField.R
html_string += '&nbsp;<input type="image" src="%s/images/exec16.png" value="update..." name="%s/portal_selections/viewSearchRelatedDocumentDialog%s:method">' \
% (portal_url_string, portal_object.getPath(), field.aq_parent._v_relation_field_index)
if value_list not in ((), [], None, ['']) and value_list == field.get_value('default'):
if value_list not in ((), [], None, ['']) and value_list == field.get_value('default') and field.get_value('jump_allowed') == 1 :
if REQUEST.get('selection_name') is not None:
html_string += '&nbsp;&nbsp;<a href="%s?field_id=%s&form_id=%s&selection_name=%s&selection_index=%s"><img src="%s/images/jump.png"></a>' \
% (field.get_value('jump_method'), field.id, field.aq_parent.id, REQUEST.get('selection_name'), REQUEST.get('selection_index'),portal_url_string)
......@@ -171,13 +171,16 @@ class MultiRelationStringFieldWidget(Widget.LinesTextAreaWidget, RelationField.R
% (field.get_value('jump_method'), field.id, field.aq_parent.id,portal_url_string)
relation_field_index = getattr(field.aq_parent, '_v_relation_field_index', 0)
field.aq_parent._v_relation_field_index = relation_field_index + 1 # Increase index
field.aq_parent._v_relation_field_index = relation_field_index + 1 # Increase index
return html_string
def render_view(self, field, value):
"""
Render text field.
"""
if field.get_value('jump_allowed') == 0 :
return Widget.LinesTextAreaWidget.render_view(self, field, value)
REQUEST = get_request()
here = REQUEST['here']
......@@ -202,7 +205,7 @@ class MultiRelationEditor:
"""
def __init__(self, field_id, base_category, portal_type, portal_type_item, key, relation_setter_id, relation_editor_list):
self.field_id = field_id
self.base_category = base_category
self.portal_type = portal_type
......@@ -218,34 +221,34 @@ class MultiRelationEditor:
for i, value, uid, display_text in self.relation_editor_list:
value_list.append(value)
value_list.append(value)
if uid is not None:
# Decorate the request so that we can display
# the select item in a popup
#relation_field_id = 'relation_%s_%s' % ( self.key, i )
#relation_item_id = 'item_%s_%s' % ( self.key, i )
relation_field_id = 'relation_field_%s_%s' % ( self.field_id, i )
relation_item_id = 'item_field_%s_%s' % ( self.field_id, i )
#relation_field_id = 'relation_%s_%s' % ( self.key, i )
#relation_item_id = 'item_%s_%s' % ( self.key, i )
relation_field_id = 'relation_field_%s_%s' % ( self.field_id, i )
relation_item_id = 'item_field_%s_%s' % ( self.field_id, i )
REQUEST.set(relation_item_id, ((display_text, uid),))
REQUEST.set(relation_field_id, uid)
REQUEST.set(self.field_id, value_list) # XXX Dirty
else:
# Make sure no default value appears
#REQUEST.set(self.field_id[len('field_'):], None)
#REQUEST.set(self.field_id[len('field_'):], None)
REQUEST.set(self.field_id, None) # XXX Dirty
def view(self):
return self.__dict__
def edit(self, o):
return self.__dict__
def edit(self, o):
if self.relation_editor_list != None:
relation_uid_list = []
relation_object_list = []
for i, value, uid, display_text in self.relation_editor_list:
if uid is not None:
if type(uid) is type('a') and uid.startswith(new_content_prefix):
......@@ -255,7 +258,7 @@ class MultiRelationEditor:
for p_item in self.portal_type_item:
if p_item[0] == portal_type:
portal_module = o.getPortalObject().getDefaultModuleId( p_item[0] )
if portal_module is not None:
if portal_module is not None:
portal_module_object = getattr(o.getPortalObject(), portal_module)
kw ={}
#kw[self.key] = value
......@@ -265,18 +268,18 @@ class MultiRelationEditor:
new_object = portal_module_object.newContent(**kw)
uid = new_object.getUid()
else:
raise
raise
relation_uid_list.append(int(uid))
relation_object_list.append( o.portal_catalog.getObject(uid) )
#if relation_uid_list != []:
# Edit relation
# Edit relation
if self.relation_setter_id:
relation_setter = getattr(o, self.relation_setter_id)
relation_setter((), portal_type=self.portal_type)
relation_setter( relation_uid_list , portal_type=self.portal_type)
relation_setter( relation_uid_list , portal_type=self.portal_type)
else:
# we could call a generic method which create the setter method name
set_method_name = '_set'+convertToUpperCase(self.base_category)+'ValueList'
......@@ -285,20 +288,20 @@ class MultiRelationEditor:
else:
# Nothing to do
pass
# # Delete relation
# # Delete relation
# if self.relation_setter_id:
# relation_setter = getattr(o, self.relation_setter_id)
# relation_setter((), portal_type=self.portal_type)
# else:
# o._setValueUids(self.base_category, (), portal_type=self.portal_type)
# o._setValueUids(self.base_category, (), portal_type=self.portal_type)
allow_class(MultiRelationEditor)
class MultiRelationStringFieldValidator(Validator.LinesValidator, RelationField.RelationStringFieldValidator):
class MultiRelationStringFieldValidator(Validator.LinesValidator, RelationField.RelationStringFieldValidator):
"""
Validation includes lookup of relared instances
"""
"""
message_names = Validator.LinesValidator.message_names + \
RelationField.RelationStringFieldValidator.message_names
......@@ -311,7 +314,7 @@ class MultiRelationStringFieldValidator(Validator.LinesValidator, RelationField
_v_message_name_list.append(message_name)
_v_dict[message_name] = 1
message_names = _v_message_name_list
def validate(self, field, key, REQUEST):
portal_type = map(lambda x:x[0],field.get_value('portal_type'))
portal_type_item = field.get_value('portal_type')
......@@ -319,14 +322,14 @@ class MultiRelationStringFieldValidator(Validator.LinesValidator, RelationField
# If the value is different, build a query
portal_selections = getToolByName(field, 'portal_selections')
portal_catalog = getToolByName(field, 'portal_catalog')
portal_catalog = getToolByName(field, 'portal_catalog')
# Get the current value
value_list = Validator.LinesValidator.validate(self, field, key, REQUEST)
# if type(value_list) == type(''):
# value_list = [value_list]
# If the value is the same as the current field value, do nothing
current_value_list = field.get_value('default')
if type(current_value_list) == type(''):
......@@ -335,24 +338,24 @@ class MultiRelationStringFieldValidator(Validator.LinesValidator, RelationField
catalog_index = field.get_value('catalog_index')
relation_setter_id = field.get_value('relation_setter_id')
relation_field_id = 'relation_%s' % ( key )
relation_field_id = 'relation_%s' % ( key )
# we must know if user validate the form or click on the wheel button
relation_uid_list = REQUEST.get(relation_field_id, None)
relation_field_sub_id = 'relation_%s_0' % ( key )
relation_field_sub_id = 'relation_%s_0' % ( key )
if checkSameKeys( value_list, current_value_list ) and (relation_uid_list is None) and (not REQUEST.has_key( relation_field_sub_id )):
# XXX Will be interpreted by Base_edit as "do nothing"
#return MultiRelationEditor(field.id, base_category, portal_type, portal_type_item, catalog_index, relation_setter_id, None)
return None
else:
relation_field_id = 'relation_%s' % ( key )
relation_field_id = 'relation_%s' % ( key )
# We must be able to erase the relation
if (value_list == ['']) and (not REQUEST.has_key( relation_field_id )):
display_text = 'Delete the relation'
return MultiRelationEditor(field.id, base_category, portal_type, portal_type_item, catalog_index, relation_setter_id, [])
# return RelationEditor(key, base_category, portal_type, None,
# return RelationEditor(key, base_category, portal_type, None,
# portal_type_item, catalog_index, value, relation_setter_id, display_text)
# Will be interpreted by Base_edit as "delete relation" (with no uid and value = '')
......@@ -363,39 +366,39 @@ class MultiRelationStringFieldValidator(Validator.LinesValidator, RelationField
relation_editor_list = []
for i in range( len(relation_uid_list) ):
relation_item_id = 'item_%s_%s' % ( key, i )
relation_item_id = 'item_%s_%s' % ( key, i )
relation_uid = relation_uid_list[i]
related_object = portal_catalog.getObject(relation_uid)
if related_object is not None:
display_text = str(related_object.getProperty(catalog_index))
else:
display_text = 'Object has been deleted'
# Check
display_text = 'Object has been deleted'
# Check
REQUEST.set(relation_item_id, ( (display_text, relation_uid), ))
# Storing display_text as value is needded in this case
relation_editor_list.append( (i, display_text, str(relation_uid), display_text) )
return MultiRelationEditor(field.id, base_category, portal_type, portal_type_item, catalog_index, relation_setter_id, relation_editor_list)
else:
# User validate the form
relation_editor_list = []
raising_error_needed = 0
raising_error_value = ''
# Check all relation
for i in range( len(value_list) ):
relation_field_id = 'relation_%s_%s' % ( key, i )
relation_item_id = 'item_%s_%s' % ( key, i )
relation_field_id = 'relation_%s_%s' % ( key, i )
relation_item_id = 'item_%s_%s' % ( key, i )
relation_uid = REQUEST.get(relation_field_id, None)
value = value_list[i]
# If we get a empty string, delete this line
if value == '':
# Clean request if necessary
......@@ -412,8 +415,8 @@ class MultiRelationStringFieldValidator(Validator.LinesValidator, RelationField
if related_object is not None:
display_text = str(related_object.getProperty(catalog_index))
else:
display_text = 'Object has been deleted'
# Check
display_text = 'Object has been deleted'
# Check
REQUEST.set(relation_item_id, ( (display_text, relation_uid), ))
relation_editor_list.append( (i, value, str(relation_uid), display_text) )
......@@ -431,9 +434,9 @@ class MultiRelationStringFieldValidator(Validator.LinesValidator, RelationField
menu_item_list = [('', '')]
new_object_menu_item_list = []
for p in portal_type:
new_object_menu_item_list += [('New %s' % p, '%s%s' % (new_content_prefix,p))]
new_object_menu_item_list += [('New %s' % p, '%s%s' % (new_content_prefix,p))]
if len(relation_list) >= MAX_SELECT:
if len(relation_list) >= MAX_SELECT:
# If the length is long, raise an error
# This parameter means we need listbox help
REQUEST.set(relation_item_id, [])
......@@ -447,14 +450,14 @@ class MultiRelationStringFieldValidator(Validator.LinesValidator, RelationField
if related_object is not None:
display_text = str(related_object.getProperty(catalog_index))
else:
display_text = 'Object has been deleted'
display_text = 'Object has been deleted'
REQUEST.set(relation_item_id, ( (display_text, relation_uid), ))
relation_editor_list.append( (0, value, relation_uid, display_text) )
elif len(relation_list) == 0:
# If the length is 0, raise an error
menu_item_list += new_object_menu_item_list
menu_item_list += new_object_menu_item_list
REQUEST.set(relation_item_id, menu_item_list)
raising_error_needed = 1
raising_error_value = 'relation_result_empty'
......@@ -462,14 +465,14 @@ class MultiRelationStringFieldValidator(Validator.LinesValidator, RelationField
else:
# If the length is short, raise an error
# len(relation_list) < MAX_SELECT:
#menu_item_list += [('-', '')]
menu_item_list += map(lambda x: (x.getObject().getProperty(catalog_index), x.uid),
#menu_item_list += [('-', '')]
menu_item_list += map(lambda x: (x.getObject().getProperty(catalog_index), x.uid),
relation_list)
REQUEST.set(relation_item_id, menu_item_list)
raising_error_needed = 1
raising_error_value = 'relation_result_ambiguous'
# validate MultiRelation field
if raising_error_needed:
# Raise error
......
......@@ -53,7 +53,7 @@ class RelationStringFieldWidget(Widget.TextWidget, Widget.ListWidget):
"""
property_names = Widget.TextWidget.property_names + \
['update_method', 'jump_method', 'base_category', 'portal_type', 'catalog_index',
['update_method', 'jump_method', 'jump_allowed', 'base_category', 'portal_type', 'catalog_index',
'default_module', 'relation_setter_id', 'columns','sort','parameter_list','list_method',
'first_item', 'items', 'size', 'extra_item']
......@@ -72,6 +72,13 @@ class RelationStringFieldWidget(Widget.TextWidget, Widget.ListWidget):
default="Base_jumpToRelatedDocument",
required=1)
jump_allowed = fields.CheckBoxField('jump_allowed',
title='Jump Allowed',
description=(
"Do we allow to jump to the relation ?"),
default=1,
required=0)
base_category = fields.StringField('base_category',
title='Base Category',
description=(
......@@ -116,8 +123,8 @@ class RelationStringFieldWidget(Widget.TextWidget, Widget.ListWidget):
"widget will be displayed as a drop down box by many browsers, "
"if set to something higher, a list will be shown. Required."),
default=1,
required=1)
required=1)
columns = fields.ListTextAreaField('columns',
title="Columns",
description=(
......@@ -164,9 +171,9 @@ class RelationStringFieldWidget(Widget.TextWidget, Widget.ListWidget):
from Products.Formulator.TALESField import TALESMethod
field.tales['items'] = TALESMethod('REQUEST/relation_item_list')
REQUEST['relation_item_list'] = REQUEST.get(relation_item_id)
html_string += '&nbsp;%s&nbsp;' % Widget.ListWidget.render(self,
field, relation_field_id, None, REQUEST)
REQUEST['relation_item_list'] = None
html_string += '&nbsp;%s&nbsp;' % Widget.ListWidget.render(self,
field, relation_field_id, None, REQUEST)
REQUEST['relation_item_list'] = None
# We used to add a button which has a path reference to a base category...
# but it really created too many problems
......@@ -176,24 +183,26 @@ class RelationStringFieldWidget(Widget.TextWidget, Widget.ListWidget):
#elif value != field.get_value('default'):
else:
html_string += '&nbsp;<input type="image" src="%s/images/exec16.png" value="update..." name="%s/portal_selections/viewSearchRelatedDocumentDialog%s:method">' \
% (portal_url_string, portal_object.getPath(),
% (portal_url_string, portal_object.getPath(),
getattr(field.aq_parent, '_v_relation_field_index', 0))
relation_field_index = getattr(field.aq_parent, '_v_relation_field_index', 0)
field.aq_parent._v_relation_field_index = relation_field_index + 1 # Increase index
field.aq_parent._v_relation_field_index = relation_field_index + 1 # Increase index
if value not in ( None, '' ) and not REQUEST.has_key(relation_item_id) and value == field.get_value('default'):
if value not in ( None, '' ) and not REQUEST.has_key(relation_item_id) and value == field.get_value('default') and field.get_value('jump_allowed') == 1 :
if REQUEST.get('selection_name') is not None:
html_string += '&nbsp;&nbsp;<a href="%s/%s?field_id=%s&form_id=%s&selection_name=%s&selection_index=%s"><img src="%s/images/jump.png"></a>' \
% (here.absolute_url(), field.get_value('jump_method'), field.id, field.aq_parent.id, REQUEST.get('selection_name'), REQUEST.get('selection_index'),portal_url_string)
else:
html_string += '&nbsp;&nbsp;<a href="%s/%s?field_id=%s&form_id=%s"><img src="%s/images/jump.png"></a>' \
% (here.absolute_url(), field.get_value('jump_method'), field.id, field.aq_parent.id,portal_url_string)
% (here.absolute_url(), field.get_value('jump_method'), field.id, field.aq_parent.id,portal_url_string)
return html_string
def render_view(self, field, value):
"""Render text input field.
"""
if field.get_value('jump_allowed') == 0 :
return Widget.TextWidget.render_view(self, field, value)
REQUEST = get_request()
here = REQUEST['here']
html_string = Widget.TextWidget.render_view(self, field, value)
......@@ -210,7 +219,7 @@ class RelationEditor:
A class holding all values required to update a relation
"""
def __init__(self, field_id, base_category, portal_type, uid, portal_type_item,
def __init__(self, field_id, base_category, portal_type, uid, portal_type_item,
key, value, relation_setter_id, display_text):
self.field_id = field_id
self.uid = uid
......@@ -221,24 +230,24 @@ class RelationEditor:
self.value = value
self.relation_setter_id = relation_setter_id
self.display_text = display_text
def __call__(self, REQUEST):
if self.uid is not None:
if self.uid is not None:
# Decorate the request so that we can display
# the select item in a popup
relation_field_id = 'relation_%s' % self.field_id
relation_field_id = 'relation_%s' % self.field_id
relation_item_id = 'item_%s' % self.field_id
REQUEST.set(relation_item_id, ((self.display_text, self.uid),))
REQUEST.set(relation_field_id, self.uid)
REQUEST.set(self.field_id[len('field_'):], self.value) # XXX Dirty
else:
# Make sure no default value appears
REQUEST.set(self.field_id[len('field_'):], None)
REQUEST.set(self.field_id[len('field_'):], None)
def view(self):
return self.__dict__
def edit(self, o):
return self.__dict__
def edit(self, o):
if self.uid is not None:
if type(self.uid) is type('a') and self.uid.startswith(new_content_prefix):
# Create a new content
......@@ -248,7 +257,7 @@ class RelationEditor:
if p_item[0] == portal_type:
#portal_module = p_item[1]
portal_module = o.getPortalObject().getDefaultModuleId( p_item[0] )
if portal_module is not None:
if portal_module is not None:
portal_module_object = getattr(o.getPortalObject(), portal_module)
kw ={}
kw[self.key] = string.join( string.split(self.value,'%'), '' )
......@@ -257,22 +266,22 @@ class RelationEditor:
new_object = portal_module_object.newContent(**kw)
self.uid = new_object.getUid()
else:
raise
raise
# Edit relation
# Edit relation
if self.relation_setter_id:
relation_setter = getattr(o, self.relation_setter_id)
relation_setter((), portal_type=self.portal_type)
relation_setter((int(self.uid),), portal_type=self.portal_type)
relation_setter((int(self.uid),), portal_type=self.portal_type)
else:
# we could call a generic method which create the setter method name
set_method_name = '_set'+convertToUpperCase(self.base_category)+'Value'
object = o.portal_catalog.getObject( self.uid )
object = o.portal_catalog.getObject( self.uid )
getattr(o, set_method_name)( object,portal_type=self.portal_type )
else:
if self.value == '':
# Delete relation
# Delete relation
if self.relation_setter_id:
relation_setter = getattr(o, self.relation_setter_id)
relation_setter((), portal_type=self.portal_type)
......@@ -284,27 +293,27 @@ class RelationEditor:
allow_class(RelationEditor)
class RelationStringFieldValidator(Validator.StringValidator):
class RelationStringFieldValidator(Validator.StringValidator):
"""
Validation includes lookup of relared instances
"""
"""
message_names = Validator.StringValidator.message_names +\
['relation_result_too_long', 'relation_result_ambiguous', 'relation_result_empty',]
relation_result_too_long = "Too many documents were found."
relation_result_ambiguous = "Select appropriate document in the list."
relation_result_empty = "No such document was found."
def validate(self, field, key, REQUEST):
relation_field_id = 'relation_%s' % key
relation_field_id = 'relation_%s' % key
relation_item_id = 'item_%s' % key
portal_type = map(lambda x:x[0],field.get_value('portal_type'))
portal_type_item = field.get_value('portal_type')
base_category = field.get_value( 'base_category')
# If the value is different, build a query
portal_selections = getToolByName(field, 'portal_selections')
portal_catalog = getToolByName(field, 'portal_catalog')
portal_catalog = getToolByName(field, 'portal_catalog')
# Get the current value
value = Validator.StringValidator.validate(self, field, key, REQUEST)
# If the value is the same as the current field value, do nothing
......@@ -317,15 +326,15 @@ class RelationStringFieldValidator(Validator.StringValidator):
if (value == current_value) and (relation_uid is None):
return None
# XXX return RelationEditor(key, base_category, portal_type, None,
# XXX return RelationEditor(key, base_category, portal_type, None,
# portal_type_item, catalog_index, value, relation_setter_id, None)
# Will be interpreted by Base_edit as "do nothing"
if relation_uid not in (None, ''):
# A value has been defined by the user
if type(relation_uid) in (type([]), type(())):
if type(relation_uid) in (type([]), type(())):
if len( relation_uid ) == 0:
# No object was selected...
self.raise_error('relation_result_too_long', field)
self.raise_error('relation_result_too_long', field)
else:
relation_uid = relation_uid[0]
......@@ -333,18 +342,18 @@ class RelationStringFieldValidator(Validator.StringValidator):
if related_object is not None:
display_text = str(related_object.getProperty(catalog_index))
else:
display_text = 'Object has been deleted'
return RelationEditor(key, base_category, portal_type, relation_uid,
display_text = 'Object has been deleted'
return RelationEditor(key, base_category, portal_type, relation_uid,
portal_type_item, catalog_index, value, relation_setter_id, display_text)
# We must be able to erase the relation
if value == '':
display_text = 'Delete the relation'
return RelationEditor(key, base_category, portal_type, None,
return RelationEditor(key, base_category, portal_type, None,
portal_type_item, catalog_index, value, relation_setter_id, display_text)
# Will be interpreted by Base_edit as "delete relation" (with no uid and value = '')
kw ={}
kw[catalog_index] = value
kw['portal_type'] = portal_type
......@@ -359,7 +368,7 @@ class RelationStringFieldValidator(Validator.StringValidator):
menu_item_list = [('', '')]
new_object_menu_item_list = []
for p in portal_type:
new_object_menu_item_list += [('New %s' % p, '%s%s' % (new_content_prefix,p))]
new_object_menu_item_list += [('New %s' % p, '%s%s' % (new_content_prefix,p))]
# If the length is 1, return uid
if len(relation_list) == 1:
relation_uid = relation_uid_list[0]
......@@ -367,29 +376,29 @@ class RelationStringFieldValidator(Validator.StringValidator):
if related_object is not None:
display_text = str(related_object.getProperty(catalog_index))
else:
display_text = 'Object has been deleted'
return RelationEditor(key, base_category, portal_type, relation_uid,
display_text = 'Object has been deleted'
return RelationEditor(key, base_category, portal_type, relation_uid,
portal_type_item, catalog_index, value, relation_setter_id, display_text)
# If the length is 0, raise an error
elif len(relation_list) == 0:
menu_item_list += new_object_menu_item_list
menu_item_list += new_object_menu_item_list
REQUEST.set(relation_item_id, menu_item_list)
self.raise_error('relation_result_empty', field)
# If the length is short, raise an error
elif len(relation_list) < MAX_SELECT:
#menu_item_list += [('-', '')]
menu_item_list += map(lambda x: (x.getObject().getProperty(catalog_index), x.uid),
elif len(relation_list) < MAX_SELECT:
#menu_item_list += [('-', '')]
menu_item_list += map(lambda x: (x.getObject().getProperty(catalog_index), x.uid),
relation_list)
REQUEST.set(relation_item_id, menu_item_list)
self.raise_error('relation_result_ambiguous', field)
else:
# If the length is long, raise an error
# If this error is raise, we don t want to create a new object...
#REQUEST.set(relation_item_id, menu_item_list)
self.raise_error('relation_result_too_long', field)
self.raise_error('relation_result_too_long', field)
RelationStringFieldWidgetInstance = RelationStringFieldWidget()
RelationStringFieldValidatorInstance = RelationStringFieldValidator()
......
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