# Path: norm/orm/error.py
# class NotFound(Error):
#     pass
# 
# Path: norm/interface.py
# class IOperator(Interface):
#     """
#     I provide functions for doing operations.  My methods are suitable for
#     use as the function in L{IRunner.runInteraction}.
#     """
# 
# 
#     def insert(cursor, obj):
#         """
#         Insert the ORM object into the database, update the object's attributes
#         and return the object.
#         """
# 
# 
#     def query(cursor, query):
#         """
#         XXX
#         """
# 
# 
#     def refresh(cursor, obj):
#         """
#         XXX
#         """
# 
# 
#     def update(cursor, obj):
#         """
#         XXX
#         """
# 
# 
#     def delete(cursor, obj):
#         """
#         XXX
#         """


from collections import defaultdict, MutableMapping
from zope.interface import implements
from norm.orm.error import NotFound
from norm.interface import IOperator
        from norm.orm.expr import Eq
        from norm.orm.expr import Neq
        from norm.orm.expr import Gt
        from norm.orm.expr import Gte
        from norm.orm.expr import Lt
        from norm.orm.expr import Lte
import inspect
import weakref
    for cls in classes:
        obj = cls.__new__(cls)
        empty_obj = True
        for prop, value in class_data[cls]:
            if empty_obj and value is not None:
                empty_obj = False
            prop.fromDatabase(obj, value)
        if empty_obj:
            # No values, None (from a Left Join or the like)
            ret.append(None)
        else:
            ret.append(obj)

    if len(ret) == 1:
        return ret[0]
    return ret


def updateObjectFromDatabase(data, obj, converter):
    """
    Update an existing object's attributes from a database response row.

    @param data: A tuple-dict thing as returned by IAsyncCursor.fetchOne
    @param obj: An ORM'd object
    @param converter: A L{Converter} instance that knows how to convert from
        database-land to python-land.

    @return: The same C{obj} with updated attributes.
    """
    if data is None:

# Path: norm/orm/error.py
# class NotFound(Error):
#     pass
# 
# Path: norm/interface.py
# class IOperator(Interface):
#     """
#     I provide functions for doing operations.  My methods are suitable for
#     use as the function in L{IRunner.runInteraction}.
#     """
# 
# 
#     def insert(cursor, obj):
#         """
#         Insert the ORM object into the database, update the object's attributes
#         and return the object.
#         """
# 
# 
#     def query(cursor, query):
#         """
#         XXX
#         """
# 
# 
#     def refresh(cursor, obj):
#         """
#         XXX
#         """
# 
# 
#     def update(cursor, obj):
#         """
#         XXX
#         """
# 
# 
#     def delete(cursor, obj):
#         """
#         XXX
#         """


# Path: norm/orm/base.py
from collections import defaultdict, MutableMapping
from zope.interface import implements
from norm.orm.error import NotFound
from norm.interface import IOperator
        from norm.orm.expr import Eq
        from norm.orm.expr import Neq
        from norm.orm.expr import Gt
        from norm.orm.expr import Gte
        from norm.orm.expr import Lt
        from norm.orm.expr import Lte
import inspect
import weakref

    for cls in classes:
        obj = cls.__new__(cls)
        empty_obj = True
        for prop, value in class_data[cls]:
            if empty_obj and value is not None:
                empty_obj = False
            prop.fromDatabase(obj, value)
        if empty_obj:
            # No values, None (from a Left Join or the like)
            ret.append(None)
        else:
            ret.append(obj)

    if len(ret) == 1:
        return ret[0]
    return ret


def updateObjectFromDatabase(data, obj, converter):
    """
    Update an existing object's attributes from a database response row.

    @param data: A tuple-dict thing as returned by IAsyncCursor.fetchOne
    @param obj: An ORM'd object
    @param converter: A L{Converter} instance that knows how to convert from
        database-land to python-land.

    @return: The same C{obj} with updated attributes.
    """
    if data is None:

        raise NotFound(obj)