# Path: ddserver/utils/deps.py
# def export(**requirements):
#   ''' Decorator to export a factory.
# 
#       Requirements for the factory can be specified. These requirements are
#       passed to the wrapped function as specified by the `require` decorator.
#   '''
# 
#   def wrapper(func):
#     return Export(factory = require(**requirements)(func))
# 
#   return wrapper
# 
# def extend(self, extend):
#   ''' Extends this export.
# 
#       The instance created by the wrapped factory is extended by passing the
#       created instance to the given extend function after creation.
# 
#       The extend function must accept the instance as its only argument. If
#       the function returns a value which is not None, the instance is replaced
#       with the returned value.
#   '''
# 
#   assert self.__instance is None
# 
#   self.__extends.append(extend)
# 
# def require(**requirements):
#   ''' Decorator to inject requirements into a function.
# 
#       The decorated function is called with a named argument for each
#       specified requirement containing the exported instances.
#   '''
# 
#   exports = {name : Export.load(requirement)
#              for name, requirement
#              in requirements.iteritems()}
# 
#   def wrapper(func):
#     def wrapped(*args, **kwargs):
#       # Update the keyword arguments with the required instances
#       kwargs.update({name : export.instance
#                      for name, export
#                      in exports.iteritems()
#                      if name not in kwargs})
# 
#       return func(*args,
#                   **kwargs)
# 
#     wrapped.__name__ = func.__name__
# 
#     return wrapped
#   return wrapper


import bottle
import beaker.middleware
from ddserver.utils.deps import export, extend, require
  def __init__(self):
    pass


  @property
  def session(self):
    return bottle.request.environ.get('beaker.session')


  def __getattr__(self, key):
    try:
      return self.session[key]

    except KeyError:
      return None


  def __setattr__(self, key, value):
    self.session[key] = value


  def __delattr__(self, key):
    del self.session[key]


  def save(self):
    self.session.save()




# Path: ddserver/utils/deps.py
# def export(**requirements):
#   ''' Decorator to export a factory.
# 
#       Requirements for the factory can be specified. These requirements are
#       passed to the wrapped function as specified by the `require` decorator.
#   '''
# 
#   def wrapper(func):
#     return Export(factory = require(**requirements)(func))
# 
#   return wrapper
# 
# def extend(self, extend):
#   ''' Extends this export.
# 
#       The instance created by the wrapped factory is extended by passing the
#       created instance to the given extend function after creation.
# 
#       The extend function must accept the instance as its only argument. If
#       the function returns a value which is not None, the instance is replaced
#       with the returned value.
#   '''
# 
#   assert self.__instance is None
# 
#   self.__extends.append(extend)
# 
# def require(**requirements):
#   ''' Decorator to inject requirements into a function.
# 
#       The decorated function is called with a named argument for each
#       specified requirement containing the exported instances.
#   '''
# 
#   exports = {name : Export.load(requirement)
#              for name, requirement
#              in requirements.iteritems()}
# 
#   def wrapper(func):
#     def wrapped(*args, **kwargs):
#       # Update the keyword arguments with the required instances
#       kwargs.update({name : export.instance
#                      for name, export
#                      in exports.iteritems()
#                      if name not in kwargs})
# 
#       return func(*args,
#                   **kwargs)
# 
#     wrapped.__name__ = func.__name__
# 
#     return wrapped
#   return wrapper


# Path: ddserver/interface/session.py
import bottle
import beaker.middleware
from ddserver.utils.deps import export, extend, require

  def __init__(self):
    pass


  @property
  def session(self):
    return bottle.request.environ.get('beaker.session')


  def __getattr__(self, key):
    try:
      return self.session[key]

    except KeyError:
      return None


  def __setattr__(self, key, value):
    self.session[key] = value


  def __delattr__(self, key):
    del self.session[key]


  def save(self):
    self.session.save()




@extend('ddserver.interface.template:TemplateManager')