# Replace these in client code as appropriate
# We love monkeys!

# pool_recycle was 1000, but that's too long for sql.mit.edu
SQLALCHEMY_ARGS = {'pool_recycle': 30,
                   'echo': 0,
                   'dburi': None}

DEFAULT_FLAVOR = 'text'

# These return uri, link text, whether the destination exists
def product_link(ename,dependencies=frozenset()):
    return (ename,ename,True)

def edit_link(ename,dependencies=frozenset()):
    return (ename,ename,True)

# Commit hooks are objects with the following methods:
# begin(username)
# setprop(ename,pname,val)
# delete(ename,pname)
# esetattr(ename,attr,val) where attr in ('parent','ename')
# edelete(ename)
# psetattr(pname,attr,val) where attr in ('flavor','default','comment','pname')
# pdelete(pname)
# prepare()
# commit()
# abort()
#
# The contract of a hook is this:
# begin will be called before update methods.
# No update methods will be called after prepare.
# prepare will be called before commit, but not necessarily before abort.
# If prepare returns without an exception,
#    the next method will either be commit or abort;
#    the commit or abort /must/ succeed in this case
# If prepare throws an exception,
#    we'll assume the transaction already aborted, and
#    nothing will be called until after another begin.
# Setting an attr on a prop or an element's parent creates it if necessary
# Setting a prop on a nonexistant element is an error
#
# The first ('primary') hook is special, in that if it does not have a
# prepare, prepare is not called, and commit is allowed to fail.
# Also, its methods are still called in read-only sessions, unlike other
# hooks.
#
# Hooks should not call other hooks, but can call other hooks in post_ methods
# that are called after the corresponding normal operations
commit_hooks = []
