ooiservices/app/uframe/assets.py
def valid_create_asset_request_data(data):
    """ Validate request_data provides required fields to create an asset. Must have metaData with key 'Ref Des'.

    TODO: validate other required items are provided, see following list of keys (data[0].keys()):
    ['Ref Des', 'deployment_number', 'asset_class', u'purchaseAndDeliveryInfo', u'lastModifiedTimestamp',
    u'physicalInfo', u'manufactureInfo', 'hasDeploymentEvent', 'coordinates', 'id', 'tense', u'dataSource',
    u'remoteDocuments', 'events', 'ref_des', u'assetInfo', u'metaData']

    """
    try:
        # Process reference designator (in metaData)
        if not 'metaData':
            message = 'Attribute \'metaData\' not provided in request data.'
            raise Exception(message)

        rd = None
        for item in data['metaData']:
            if item['key'] == 'Ref Des':
                rd = item['value']
                break

        if rd is None:
            message = 'Attribute \'Ref Des\' not provided, or empty, in request data (metaData).'
            raise Exception(message)

    except Exception as err:
        message = str(err.message)
        current_app.logger.info(message)
        raise
 Validate request_data provides required fields to create an asset. Must have metaData with key 'Ref Des'.

    TODO: validate other required items are provided, see following list of keys (data[0].keys()):
    ['Ref Des', 'deployment_number', 'asset_class', u'purchaseAndDeliveryInfo', u'lastModifiedTimestamp',
    u'physicalInfo', u'manufactureInfo', 'hasDeploymentEvent', 'coordinates', 'id', 'tense', u'dataSource',
    u'remoteDocuments', 'events', 'ref_des', u'assetInfo', u'metaData']

    
Validate request_data provides required fields to create an asset. Must have metaData with key 'Ref Des'.
Validate request_data provides required fields to create an asset . Must have metaData with key ' Ref Des ' .
def valid_create_asset_request_data(data):
    try:
        if not 'metaData':
            message = 'Attribute \'metaData\' not provided in request data.'
            raise Exception(message)
        rd = None
        for item in data['metaData']:
            if item['key'] == 'Ref Des':
                rd = item['value']
                break
        if rd is None:
            message = 'Attribute \'Ref Des\' not provided, or empty, in request data (metaData).'
            raise Exception(message)
    except Exception as err:
        message = str(err.message)
        current_app.logger.info(message)
        raise
def valid_create_asset_request_data ( data ) : try : if not 'metaData' : message = 'Attribute \'metaData\' not provided in request data.' raise Exception ( message ) rd = None for item in data [ 'metaData' ] : if item [ 'key' ] == 'Ref Des' : rd = item [ 'value' ] break if rd is None : message = 'Attribute \'Ref Des\' not provided, or empty, in request data (metaData).' raise Exception ( message ) except Exception as err : message = str ( err . message ) current_app . logger . info ( message ) raise
Validate request_data provides required fields to create an asset.
Validate request_data provides required fields to create an asset .
""" Validate request_data provides required fields to create an asset. Must have metaData with key 'Ref Des'.

    TODO: validate other required items are provided, see following list of keys (data[0].keys()):
    ['Ref Des', 'deployment_number', 'asset_class', u'purchaseAndDeliveryInfo', u'lastModifiedTimestamp',
    u'physicalInfo', u'manufactureInfo', 'hasDeploymentEvent', 'coordinates', 'id', 'tense', u'dataSource',
    u'remoteDocuments', 'events', 'ref_des', u'assetInfo', u'metaData']

    """ # Process reference designator (in metaData)
data