# 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
    """

    def __init__(self):
        self.converters = defaultdict(lambda: [])


    def when(self, key):
        """
        """
        def deco(f):
            self.converters[key].append(f)
            return f
        return deco


    def convert(self, key, value):
        """
        XXX
        """
        for conv in self.converters[key]:
            value = conv(value)
        return value



class BaseOperator(object):
    """
    I provide asynchronous CRUD database access with objects.
    """


# 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

    """

    def __init__(self):
        self.converters = defaultdict(lambda: [])


    def when(self, key):
        """
        """
        def deco(f):
            self.converters[key].append(f)
            return f
        return deco


    def convert(self, key, value):
        """
        XXX
        """
        for conv in self.converters[key]:
            value = conv(value)
        return value



class BaseOperator(object):
    """
    I provide asynchronous CRUD database access with objects.
    """


    implements(IOperator)