Beispiel #1
0
def get_resource(session=None, exception_when_missing=True,  **kwargs):
    """
    :param session:
    :param exception_when_missing: raise exception when missing
    :return:get field of the resource
    """
    return utils.get_db_object(
        session, Resource, exception_when_missing, **kwargs)
Beispiel #2
0
def get_resource(session=None, exception_when_missing=True, **kwargs):
    """
    :param session:
    :param exception_when_missing: raise exception when missing
    :return:get field of the resource
    """
    return utils.get_db_object(session, Resource, exception_when_missing,
                               **kwargs)
Beispiel #3
0
def _get_gateway(session, gateway_id, exception_when_missing=True):
    return utils.get_db_object(session, Gateway, exception_when_missing=exception_when_missing, id=gateway_id)
Beispiel #4
0
def _get_gateway(session, gateway_id, exception_when_missing=True):
    return utils.get_db_object(session,
                               Gateway,
                               exception_when_missing=exception_when_missing,
                               id=gateway_id)
Beispiel #5
0
def _update_resource(session, resource_id, **kwargs):
    res = utils.get_db_object(session, Resource, id=resource_id)
    return utils.update_db_object(session, res, **kwargs)
Beispiel #6
0
def _user_gateway(session, user_name, exception_when_missing=True):
    return utils.get_db_object(session, User, exception_when_missing=exception_when_missing, username=user_name)
Beispiel #7
0
def delete_user(session, username, **kwargs):
    user = utils.get_db_object(session, User, exception_when_missing=False, username=username)
    return utils.del_db_object(session, user)
def get_sensor_group(session, sg_id):
    return utils.get_db_object(session, SensorGroup, id=sg_id)
Beispiel #9
0
def get_gateway_model(session, gateway_id, exception_when_missing=False):
    return utils.get_db_object(session,
                               GatewayModel,
                               exception_when_missing=exception_when_missing,
                               gateway_id=gateway_id)
Beispiel #10
0
def _update_resource(session, resource_id, **kwargs):
    res = utils.get_db_object(session, Resource, id=resource_id)
    return utils.update_db_object(session, res, **kwargs)