def __init__(self, global_config, **local_conf):
<EOL>mapper = routes.Mapper(register=False)<EOL>self.resources = {}<EOL>extensions = {}<EOL>for key, value in local_conf.items():<EOL><INDENT>if '<STR_LIT:.>' not in key:<EOL><INDENT>continue<EOL><DEDENT>item_type, item_name = key.split('<STR_LIT:.>', <NUM_LIT:1>)<EOL>if item_type == '<STR_LIT>':<EOL><INDENT>values = value.split()<EOL>ext_list = []<EOL>seen = set()<EOL>for value in values:<EOL><INDENT>if value in seen:<EOL><INDENT>continue<EOL><DEDENT>ext_list.append(value)<EOL>seen.add(value)<EOL><DEDENT>extensions[item_name] = ext_list<EOL><DEDENT>elif item_type == '<STR_LIT>':<EOL><INDENT>controller = utils.import_controller(value)<EOL>self.resources[item_name] = controller(mapper)<EOL><DEDENT><DEDENT>for name, ext_list in extensions.items():<EOL><INDENT>if name not in self.resources:<EOL><INDENT>raise exceptions.NoSuchResource(name)<EOL><DEDENT>res = self.resources[name]<EOL>for ext_class in ext_list:<EOL><INDENT>ext = utils.import_controller(ext_class)<EOL>res.wsgi_extend(ext())<EOL><DEDENT><DEDENT>super(Application, self).__init__(self.dispatch, mapper,<EOL>singleton=False)<EOL>
Initialize the Application.