示例#1
0
文件: dao.py 项目: jaunis/xivo-dao
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
文件: dao.py 项目: jlebleu/xivo-dao
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
文件: dao.py 项目: jlebleu/xivo-dao
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
文件: dao.py 项目: jaunis/xivo-dao
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
文件: dao.py 项目: jaunis/xivo-dao
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
文件: dao.py 项目: jaunis/xivo-dao
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
文件: dao.py 项目: jlebleu/xivo-dao
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
文件: dao.py 项目: jlebleu/xivo-dao
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
文件: dao.py 项目: jaunis/xivo-dao
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
文件: dao.py 项目: jlebleu/xivo-dao
def get(session, extension_id):
    row = _fetch_extension_row(session, extension_id)
    return db_converter.to_model(row)
示例#11
0
文件: dao.py 项目: jaunis/xivo-dao
def get(session, extension_id):
    row = _fetch_extension_row(session, extension_id)
    return db_converter.to_model(row)