parameters: (self, id, ob, **kw)
return_statement: return ob
docstring: Make any change related to the file uploaded.
docstring_summary: Make any change related to the file uploaded.
docstring_tokens: Make any change related to the file uploaded .
function: def WebSection_setObject(self, id, ob, **kw):
    """
      Make any change related to the file uploaded.
    """
    portal = self.getPortalObject()
    data = self.REQUEST.get('BODY')
    schema = self.WebSite_getJSONSchema()
    structure = json.loads(data)
    # 0 elementh in structure is json in json
    # 1 elementh is just signature
    structure = [json.loads(structure[0]), structure[1]]
  
    validictory.validate(structure, schema)
  
    file_name = structure[0].get('file', None)
    expiration_date = structure[0].get('expiration_date', None)
  
    data_set = portal.portal_catalog.getResultValue(portal_type='Data Set',
                                                    reference=id)
    if data_set is None:
      data_set = portal.data_set_module.newContent(portal_type='Data Set',
                                                   reference=id)
      with super_user():
        # security check should be done already.
        data_set.publish()
  
  
    reference = hashlib.sha512(data).hexdigest()
    ob.setFilename(file_name)
    ob.setFollowUp(data_set.getRelativeUrl())
    ob.setContentType('application/json')
    ob.setReference(reference)
    if expiration_date is not None:
      ob.setExpirationDate(expiration_date)
    with super_user():
      # security check should be done already.
      ob.publish()
    return ob
function_tokens: def WebSection_setObject ( self , id , ob , * * kw ) : portal = self . getPortalObject ( ) data = self . REQUEST . get ( 'BODY' ) schema = self . WebSite_getJSONSchema ( ) structure = json . loads ( data ) # 0 elementh in structure is json in json # 1 elementh is just signature structure = [ json . loads ( structure [ 0 ] ) , structure [ 1 ] ] validictory . validate ( structure , schema ) file_name = structure [ 0 ] . get ( 'file' , None ) expiration_date = structure [ 0 ] . get ( 'expiration_date' , None ) data_set = portal . portal_catalog . getResultValue ( portal_type = 'Data Set' , reference = id ) if data_set is None : data_set = portal . data_set_module . newContent ( portal_type = 'Data Set' , reference = id ) with super_user ( ) : # security check should be done already. data_set . publish ( ) reference = hashlib . sha512 ( data ) . hexdigest ( ) ob . setFilename ( file_name ) ob . setFollowUp ( data_set . getRelativeUrl ( ) ) ob . setContentType ( 'application/json' ) ob . setReference ( reference ) if expiration_date is not None : ob . setExpirationDate ( expiration_date ) with super_user ( ) : # security check should be done already. ob . publish ( ) return ob