"""Class decorator for adding applications to the ApplicationRegistry"""
ApplicationRegistry().add(cls())
return cls
def load_applications():
toplevel = os.path.dirname(__file__)
app_list = ['sylk.applications.%s' % item for item in os.listdir(toplevel) if os.path.isdir(os.path.join(toplevel, item)) and '__init__.py' in os.listdir(os.path.join(toplevel, item))]
map(__import__, app_list)
class IncomingRequestHandler(object):
"""
Handle incoming requests and match them to applications.
"""
__metaclass__ = Singleton
implements(IObserver)
# TODO: implement a 'find_application' function which will get the appropriate application
# as defined in the configuration
# TODO: apply ACLs (before or after?)
def __init__(self):
load_applications()
log.msg('Loaded applications: %s' % ', '.join([app.__appname__ for app in ApplicationRegistry()]))
+ self.application_map = dict((item.split(':')) for item in ServerConfig.application_map)