def process_all(self, function):
        self.log.debug('get: %s' % function)
        static_file = re.match(r"^/*res\/(.*)$", function)
        attr_call = re.match(r"^\/*(\w+)\/(\w+)\?{0,1}(\w*\={1}\w+\${0,1})*$", function)
        if (function == '/') or (not function):
            # build the root page once if necessary
            should_call_main = not hasattr(self.client, 'root')
            if should_call_main:
                self.client.root = self.main(*self.server.userdata)

            self.send_response(200)
            self.send_header('Content-type', 'text/html')
            self.end_headers()
            self.wfile.write(encode_text("<!DOCTYPE html>\n"))
            self.wfile.write(encode_text("<html>\n<head>\n"))
            self.wfile.write(encode_text(
                """<meta content='text/html;charset=utf-8' http-equiv='Content-Type'>
                <meta content='utf-8' http-equiv='encoding'>
                <meta name="viewport" content="width=device-width, initial-scale=1.0">"""))
            self.wfile.write(encode_text(self.client.css_header))
            self.wfile.write(encode_text(self.client.html_header))
            self.wfile.write(encode_text(self.client.script_header))
            self.wfile.write(encode_text("\n</head>\n<body>\n"))
            # render the HTML replacing any local absolute references to the correct IP of this instance
            html = self.client.root.repr(self.client)
            self.wfile.write(encode_text(html))
            self.wfile.write(encode_text(self.client.html_footer))
            self.wfile.write(encode_text("</body>\n</html>"))
        elif static_file:
            static_paths = [os.path.join(os.path.dirname(__file__), 'res')]
            static_paths.extend(self._app_args.get('static_paths', ()))

            filename = None
            found = False
            for s in reversed(static_paths):
                filename = os.path.join(s, static_file.groups()[0])
                if os.path.exists(filename):
                    found = True
                    break

            if not found:
                self.send_response(404)
                return

            mimetype,encoding = mimetypes.guess_type(filename)
            self.send_response(200)
            self.send_header('Content-type', mimetype if mimetype else 'application/octet-stream')
            if self.server.enable_file_cache:
                self.send_header('Cache-Control', 'public, max-age=86400')
            self.end_headers()
            with open(filename, 'rb') as f:
                content = f.read()
                self.wfile.write(content)
        elif attr_call:
            params = list()
            param_dict = parse_qs(urlparse(function).query)
            for k in param_dict:
                params.append(param_dict[k])

            widget, function = attr_call.group(1, 2)
            try:
                content, headers = get_method_by(get_method_by(self.client.root, widget), function)(*params)
                if content is None:
                    self.send_response(503)
                    return
                self.send_response(200)
            except __HOLE__:
                self.log.error('attr %s/%s call error' % (widget, function), exc_info=True)
                self.send_response(404)
                return
            except (TypeError, AttributeError):
                self.log.error('attr %s/%s not available' % (widget, function))
                self.send_response(503)
                return

            for k in headers.keys():
                self.send_header(k, headers[k])
            self.end_headers()
            self.wfile.write(content)
dataset/ETHPy150Open dddomodossola/remi/remi/server.py/App.process_all