pgcontents/db_utils.py
def to_dict_with_content(fields, row, decrypt_func):
    """
    Convert a SQLAlchemy row that contains a 'content' field to a dict.

    ``decrypt_func`` will be applied to the ``content`` field of the row.

    If row is None, return None.

    Raises AssertionError if there is no field named 'content' in ``fields``.
    """
    assert(len(fields) == len(row))

    field_names = list(map(_get_name, fields))
    assert 'content' in field_names, "Missing content field."

    result = dict(zip(field_names, row))
    result['content'] = decrypt_func(result['content'])
    return result
def to_dict_with_content(fields, row, decrypt_func):
    """
    Convert a SQLAlchemy row that contains a 'content' field to a dict.

    ``decrypt_func`` will be applied to the ``content`` field of the row.

    If row is None, return None.

    Raises AssertionError if there is no field named 'content' in ``fields``.
    """
    assert(len(fields) == len(row))

    field_names = list(map(_get_name, fields))
    assert 'content' in field_names, "Missing content field."

    result = dict(zip(field_names, row))
    result['content'] = decrypt_func(result['content'])
    return result
def to_dict_with_content ( fields , row , decrypt_func ) : assert ( len ( fields ) == len ( row ) ) field_names = list ( map ( _get_name , fields ) ) assert 'content' in field_names , "Missing content field." result = dict ( zip ( field_names , row ) ) result [ 'content' ] = decrypt_func ( result [ 'content' ] ) return result
Convert a SQLAlchemy row that contains a 'content' field to a dict.

    ``decrypt_func`` will be applied to the ``content`` field of the row.

    If row is None, return None.

    Raises AssertionError if there is no field named 'content' in ``fields``.
Convert a SQLAlchemy row that contains a content field to a dict .