if hash_script_id: return getattr(self, hash_script_id)( item_list, value_list, default_sub_field_property_dict=empty_sub_field_property_dict, is_right_display=0) else: # No hash_script founded, generate a little hash_script # to display only a MultiListField empty_sub_field_property_dict['item_list'] = item_list empty_sub_field_property_dict['value'] = value_list return [empty_sub_field_property_dict] def paralellListFieldGetValue(field, id, REQUEST=None, **kw): result = MARKER key = KEYWORD % id if REQUEST is not None and REQUEST.has_key(key): result = REQUEST.get(key) if result is MARKER: result = ZMIField.get_value(field, id, REQUEST=REQUEST, **kw) return result # Register get_value from Products.ERP5Form.ProxyField import registerOriginalGetValueClassAndArgument registerOriginalGetValueClassAndArgument( ParallelListField, ('title', 'required', 'size', 'default', 'first_item', 'items'), paralellListFieldGetValue)
def get_orig_value(self, id): """ Get value for id; don't do any override calculation. """ if id in ('is_relation_field', 'is_multi_relation_field'): result = 1 else: result = ZMIField.get_orig_value(self, id) return result security.declareProtected('Access contents information', 'get_value') def get_value(self, id, REQUEST=None, **kw): """Get value for id. Optionally pass keyword arguments that get passed to TALES expression. """ if (id == 'items') and (REQUEST is not None): # relation_item_list is not editable for the RelationField result = REQUEST.get('relation_item_list', None) else: result = ZMIField.get_value(self, id, REQUEST=REQUEST, **kw) return result # Register get_value from Products.ERP5Form.ProxyField import registerOriginalGetValueClassAndArgument registerOriginalGetValueClassAndArgument(MultiRelationStringField, 'items')
validator = MultiRelationStringFieldValidatorInstance security.declareProtected('Access contents information', 'get_orig_value') def get_orig_value(self, id): """ Get value for id; don't do any override calculation. """ if id in ('is_relation_field', 'is_multi_relation_field'): result = 1 else: result = ZMIField.get_orig_value(self, id) return result security.declareProtected('Access contents information', 'get_value') def get_value(self, id, REQUEST=None, **kw): """Get value for id. Optionally pass keyword arguments that get passed to TALES expression. """ if (id == 'items') and (REQUEST is not None): # relation_item_list is not editable for the RelationField result = REQUEST.get('relation_item_list', None) else: result = ZMIField.get_value(self, id, REQUEST=REQUEST, **kw) return result # Register get_value from Products.ERP5Form.ProxyField import registerOriginalGetValueClassAndArgument registerOriginalGetValueClassAndArgument(MultiRelationStringField, 'items')
class MatrixBox(ZMIField): meta_type = "MatrixBox" widget = MatrixBoxWidgetInstance validator = MatrixBoxValidatorInstance security = ClassSecurityInfo() security.declareProtected('Access contents information', 'get_value') def get_value(self, id, **kw): if id == 'default' and kw.get('render_format') in ('list', ): return self.widget.render(self, self.generate_field_key(), None, kw.get('REQUEST'), render_format=kw.get('render_format')) else: return ZMIField.get_value(self, id, **kw) # Psyco from Products.ERP5Type.PsycoWrapper import psyco psyco.bind(MatrixBoxWidget.render) psyco.bind(MatrixBoxValidator.validate) # Register get_value from Products.ERP5Form.ProxyField import registerOriginalGetValueClassAndArgument registerOriginalGetValueClassAndArgument(MatrixBox, 'default')
raise FormValidationError(error_list, {}) return result MatrixBoxValidatorInstance = MatrixBoxValidator() class MatrixBox(ZMIField): meta_type = "MatrixBox" widget = MatrixBoxWidgetInstance validator = MatrixBoxValidatorInstance security = ClassSecurityInfo() security.declareProtected('Access contents information', 'get_value') def get_value(self, id, **kw): if id=='default' and kw.get('render_format') in ('list', ): return self.widget.render(self, self.generate_field_key(), None, kw.get('REQUEST'), render_format=kw.get('render_format')) else: return ZMIField.get_value(self, id, **kw) # Psyco from Products.ERP5Type.PsycoWrapper import psyco psyco.bind(MatrixBoxWidget.render) psyco.bind(MatrixBoxValidator.validate) # Register get_value from Products.ERP5Form.ProxyField import registerOriginalGetValueClassAndArgument registerOriginalGetValueClassAndArgument(MatrixBox, 'default')
hash_script_id = self.get_value("hash_script_id", REQUEST=REQUEST) if hash_script_id: return getattr(self, hash_script_id)( item_list, value_list, default_sub_field_property_dict=empty_sub_field_property_dict, is_right_display=0 ) else: # No hash_script founded, generate a little hash_script # to display only a MultiListField empty_sub_field_property_dict["item_list"] = item_list empty_sub_field_property_dict["value"] = value_list return [empty_sub_field_property_dict] def paralellListFieldGetValue(field, id, REQUEST=None, **kw): result = MARKER key = KEYWORD % id if REQUEST is not None and REQUEST.has_key(key): result = REQUEST.get(key) if result is MARKER: result = ZMIField.get_value(field, id, REQUEST=REQUEST, **kw) return result # Register get_value from Products.ERP5Form.ProxyField import registerOriginalGetValueClassAndArgument registerOriginalGetValueClassAndArgument( ParallelListField, ("title", "required", "size", "default", "first_item", "items"), paralellListFieldGetValue )