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

APP_NAME = u'Bazbase'

# This should return a dict that contains at least a 'url' key
def get_sqlalchemy_args():
    raise NotImplementedError("bazbase.get_sqlalchemy_args not overridden")

DEFAULT_FLAVOR = u'text'

# These return uri, link text, whether the destination exists
def product_link(ename, pname=None, dependencies=None,
                 render=None, extension=None, args=None):
    suffix = '.'+extension if extension else ''
    if pname:
        return (pname, dict(url=ename + '/' + pname + suffix,
                            style='internal'))
    else:
        return (ename, dict(url=ename + suffix,
                            style='internal'))

edit_link = product_link

def local_link(uri):
    return uri

# Special element and property names
PARENT_ELEMENT = u'parent'
ME_ELEMENT = u'me'
CURRENT_ELEMENT = u'current'
LEAF_ELEMENT = u'leaf'

THIS_PROP = u'this'
SUBSTITUTION_PROP = u'substitution'
NAME_PROP = u'name'
ELEMENT_NAME_PROP = u'element_name'

# Version control 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)
# commit()
# abort()
#
# The contract of a hook is this:
# begin will be called before update methods.
# If commit throws an exception,
#    we'll assume the transaction already aborted, and
#    nothing will be called until after another begin.
# Abort should never fail.
# 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
#
# Hooks should not call other hooks, but can call other hooks in post_ methods
# that are called after the corresponding normal operations
version_control_hook = None

def is_omniscient(environ=None):
    return False
