コード例 #1
0
ファイル: PropertyManager.py プロジェクト: MarkTang/erp5
def PropertyManager_manage_addProperty(self, id, value, type, REQUEST=None):
    """Add a new property via the web. Sets a new property with
    the given id, type, and value."""
    if type_converters.has_key(type):
        value=type_converters[type](value)
    #LOG('manage_addProperty', 0, 'id = %r, value = %r, type = %r, REQUEST = %r' % (id, value, type, REQUEST))
    self._setProperty(id.strip(), value, type)
    if REQUEST is not None:
        return self.manage_propertiesForm(self, REQUEST)
コード例 #2
0
ファイル: PropertyManager.py プロジェクト: MarkTang/erp5
def PropertyManager_updateProperty(self, id, value, local_properties=False):
    # Update the value of an existing property. If value
    # is a string, an attempt will be made to convert
    # the value to the type of the existing property.
    self._wrapperCheck(value)
    if not hasattr(self, 'isRADContent'):
      if not self.hasProperty(id):
          raise BadRequest, 'The property %s does not exist' % escape(id)
    if isinstance(value, str):
        proptype=self.getPropertyType(id, local_properties=local_properties) \
           or 'string'
        if type_converters.has_key(proptype):
            value=type_converters[proptype](value)
    self._setPropValue(id, value)
コード例 #3
0
def PropertyManager_updateProperty(self, id, value, local_properties=False):
    # Update the value of an existing property. If value
    # is a string, an attempt will be made to convert
    # the value to the type of the existing property.
    self._wrapperCheck(value)
    if not hasattr(self, 'isRADContent'):
        if not self.hasProperty(id):
            raise BadRequest, 'The property %s does not exist' % escape(id)
    if isinstance(value, str):
        proptype=self.getPropertyType(id, local_properties=local_properties) \
           or 'string'
        if type_converters.has_key(proptype):
            value = type_converters[proptype](value)
    self._setPropValue(id, value)