labpack/storage/appdata.py
def load(self, record_key, secret_key=''):

        ''' 
            a method to retrieve byte data of appdata record

        :param record_key: string with name of record
        :param secret_key: [optional] string used to decrypt data
        :return: byte data for record body
        '''

        title = '%s.load' % self.__class__.__name__
    
    # validate inputs
        input_fields = {
            'record_key': record_key,
            'secret_key': secret_key
        }
        for key, value in input_fields.items():
            if value:
                object_title = '%s(%s=%s)' % (title, key, str(value))
                self.fields.validate(value, '.%s' % key, object_title)

    # construct path to file
        from os import path
        file_path = path.join(self.collection_folder, record_key)

    # validate existence of file
        if not path.exists(file_path):
            raise Exception('%s(record_key=%s) does not exist.' % (title, record_key))

    # open file and read data
        record_data = open(file_path, 'rb').read()
    
    # decrypt (if necessary)
        if secret_key:
            from labpack.encryption import cryptolab
            record_data = cryptolab.decrypt(record_data, secret_key)
    
        return record_data
 
            a method to retrieve byte data of appdata record

        :param record_key: string with name of record
        :param secret_key: [optional] string used to decrypt data
        :return: byte data for record body
        
a method to retrieve byte data of appdata record
a method to retrieve byte data of appdata record
def load(self, record_key, secret_key=''):
        title = '%s.load' % self.__class__.__name__
        input_fields = {
            'record_key': record_key,
            'secret_key': secret_key
        }
        for key, value in input_fields.items():
            if value:
                object_title = '%s(%s=%s)' % (title, key, str(value))
                self.fields.validate(value, '.%s' % key, object_title)
        from os import path
        file_path = path.join(self.collection_folder, record_key)
        if not path.exists(file_path):
            raise Exception('%s(record_key=%s) does not exist.' % (title, record_key))
        record_data = open(file_path, 'rb').read()
        if secret_key:
            from labpack.encryption import cryptolab
            record_data = cryptolab.decrypt(record_data, secret_key)
        return record_data
def load ( self , record_key , secret_key = '' ) : title = '%s.load' % self . __class__ . __name__ input_fields = { 'record_key' : record_key , 'secret_key' : secret_key } for key , value in input_fields . items ( ) : if value : object_title = '%s(%s=%s)' % ( title , key , str ( value ) ) self . fields . validate ( value , '.%s' % key , object_title ) from os import path file_path = path . join ( self . collection_folder , record_key ) if not path . exists ( file_path ) : raise Exception ( '%s(record_key=%s) does not exist.' % ( title , record_key ) ) record_data = open ( file_path , 'rb' ) . read ( ) if secret_key : from labpack . encryption import cryptolab record_data = cryptolab . decrypt ( record_data , secret_key ) return record_data
a method to retrieve byte data of appdata record
a method to retrieve byte data of appdata record
''' 
            a method to retrieve byte data of appdata record

        :param record_key: string with name of record
        :param secret_key: [optional] string used to decrypt data
        :return: byte data for record body
        ''' # validate inputs
 # construct path to file
 # validate existence of file
 # open file and read data
 # decrypt (if necessary)

byte data for record body
byte data for record body
self
record_key
string with name of record
string with name of record
secret_key
[optional] string used to decrypt data
[ optional ] string used to decrypt data