Пример #1
0
def find(session, extension_id):
    extension_row = (session.query(ExtensionSchema).filter(
        ExtensionSchema.id == extension_id).first())

    if not extension_row:
        return None

    return db_converter.to_model(extension_row)
Пример #2
0
def find(session, extension_id):
    extension_row = (session.query(ExtensionSchema)
                     .filter(ExtensionSchema.id == extension_id)
                     .first())

    if not extension_row:
        return None

    return db_converter.to_model(extension_row)
Пример #3
0
def _rows_to_extension_model(extension_rows):
    if not extension_rows:
        return []

    extensions = []
    for extension_row in extension_rows:
        extensions.append(db_converter.to_model(extension_row))

    return extensions
Пример #4
0
def find_by_exten_context(session, exten, context):
    extension_row = (session.query(ExtensionSchema).filter(
        ExtensionSchema.exten == exten).filter(
            ExtensionSchema.context == context).first())

    if not extension_row:
        return None

    return db_converter.to_model(extension_row)
Пример #5
0
def get_by_exten_context(session, exten, context):
    res = (session.query(ExtensionSchema).filter(
        ExtensionSchema.exten == exten).filter(
            ExtensionSchema.context == context)).first()

    if not res:
        raise ElementNotExistsError('Extension', exten=exten, context=context)

    return db_converter.to_model(res)
Пример #6
0
def _rows_to_extension_model(extension_rows):
    if not extension_rows:
        return []

    extensions = []
    for extension_row in extension_rows:
        extensions.append(db_converter.to_model(extension_row))

    return extensions
Пример #7
0
def find_by_exten_context(session, exten, context):
    extension_row = (session.query(ExtensionSchema)
                     .filter(ExtensionSchema.exten == exten)
                     .filter(ExtensionSchema.context == context)
                     .first())

    if not extension_row:
        return None

    return db_converter.to_model(extension_row)
Пример #8
0
def get_by_exten_context(session, exten, context):
    res = (session.query(ExtensionSchema)
           .filter(ExtensionSchema.exten == exten)
           .filter(ExtensionSchema.context == context)
           ).first()

    if not res:
        raise errors.not_found('Extension', exten=exten, context=context)

    return db_converter.to_model(res)
Пример #9
0
def get_by_exten_context(session, exten, context):
    res = (session.query(ExtensionSchema)
           .filter(ExtensionSchema.exten == exten)
           .filter(ExtensionSchema.context == context)
           ).first()

    if not res:
        raise ElementNotExistsError('Extension', exten=exten, context=context)

    return db_converter.to_model(res)
Пример #10
0
def get(session, extension_id):
    row = _fetch_extension_row(session, extension_id)
    return db_converter.to_model(row)
Пример #11
0
def get(session, extension_id):
    row = _fetch_extension_row(session, extension_id)
    return db_converter.to_model(row)