def map_app(self):
        "determine application name"
        base = routers.BASE  # base router
        self.domain_application = None
        self.domain_controller = None
        self.domain_function = None
        arg0 = self.harg0
        if not base.exclusive_domain and base.applications and arg0 in base.applications:
            self.application = arg0
        elif not base.exclusive_domain and arg0 and not base.applications:
            self.application = arg0
        elif base.domains in (self.host, self.port):
            (self.application, self.domain_controller,
             self.domain_function) = base.domains[(self.host, self.port)]
            self.env['domain_application'] = self.application
            self.env['domain_controller'] = self.domain_controller
            self.env['domain_function'] = self.domain_function
        elif (self.host, None) in base.domains:
            (self.application, self.domain_controller,
             self.domain_function) = base.domains[(self.host, None)]
            self.env['domain_application'] = self.application
            self.env['domain_controller'] = self.domain_controller
            self.env['domain_function'] = self.domain_function
        elif base.applications and arg0 in base.applications:
            self.application = arg0
        elif arg0 and not base.applications:
            self.application = arg0
        else:
            self.application = base.default_application or ''
        self.pop_arg_if(self.application == arg0)

        if not base._acfe_match.match(self.application):
            raise HTTP(
                400, THREAD_LOCAL.routes.error_message % 'invalid request',
                web2py_error="invalid application: '%s'" % self.application)

        if self.application not in routers and \
                (self.application != THREAD_LOCAL.routes.default_application or self.application == 'welcome'):
            raise HTTP(
                400, THREAD_LOCAL.routes.error_message % 'invalid request',
                web2py_error="unknown application: '%s'" % self.application)

        #  set the application router
        #
        log_rewrite("select application=%s" % self.application)
        self.request.application = self.application
        if self.application not in routers:
            self.router = routers.BASE                # support gluon.main.wsgibase init->welcome
        else:
            self.router = routers[self.application]   # application router
        self.controllers = self.router.controllers
        self.default_controller = self.domain_controller or self.router.default_controller
        self.functions = self.router.functions
        self.languages = self.router.languages
        self.default_language = self.router.default_language
        self.map_hyphen = self.router.map_hyphen
        self.exclusive_domain = self.router.exclusive_domain
        self._acfe_match = self.router._acfe_match
        self.file_match = self.router.file_match
        self._file_match = self.router._file_match
        self._args_match = self.router._args_match
dataset/ETHPy150Open uwdata/termite-visualizations/web2py/gluon/rewrite.py/MapUrlIn.map_app/swapped operands of `in`