Exemplo n.º 1
0
def PropertyManager_delProperty(self, id):
    if not self.hasProperty(id):
        raise ValueError, 'The property %s does not exist' % escape(id)
    self._delPropValue(id)
    self._local_properties = tuple(
        filter(lambda i, n=id: i['id'] != n,
               getattr(self, '_local_properties', ())))
Exemplo n.º 2
0
def PropertyManager_valid_property_id(self, id):
    # This is required because in order to disable acquisition
    # we set all properties with a None value on the class Base,
    # so wee need to check if the property is not on Base.__dict__

    from Products.ERP5Type.Base import Base
    if not id or id[:1]=='_' or (id[:3]=='aq_') \
       or (' ' in id) or (hasattr(aq_base(self), id) and \
       not (Base.__dict__.has_key(id) and Base.__dict__[id] is None)) or escape(id) != id:
        return 0
    return 1
Exemplo n.º 3
0
def PropertyManager_valid_property_id(self, id):
    # This is required because in order to disable acquisition
    # we set all properties with a None value on the class Base,
    # so wee need to check if the property is not on Base.__dict__

    from Products.ERP5Type.Base import Base
    if not id or id[:1]=='_' or (id[:3]=='aq_') \
       or (' ' in id) or (hasattr(aq_base(self), id) and \
       not (Base.__dict__.has_key(id) and Base.__dict__[id] is None)) or escape(id) != id:
        return 0
    return 1
Exemplo n.º 4
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)
Exemplo n.º 5
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)
Exemplo n.º 6
0
def PropertyManager_delProperty(self, id):
    if not self.hasProperty(id):
        raise ValueError, 'The property %s does not exist' % escape(id)
    self._delPropValue(id)
    self._local_properties=tuple(filter(lambda i, n=id: i['id'] != n,
                                  getattr(self, '_local_properties', ())))