def include_files(self, extensions=None):

        """
        Caching method for writing out files.
        By default, caches in ram for 5 minutes. To change,
        response.cache_includes = (cache_method, time_expire).
        Example: (cache.disk, 60) # caches to disk for 1 minute.
        """
        from gluon import URL

        files = []
        has_js = has_css = False
        for item in self.files:
            if extensions and not item.split('.')[-1] in extensions:
                continue
            if item in files:
                continue
            if item.endswith('.js'):
                has_js = True
            if item.endswith('.css'):
                has_css = True
            files.append(item)

        if have_minify and ((self.optimize_css and has_css) or (self.optimize_js and has_js)):
            # cache for 5 minutes by default
            key = hashlib.md5(repr(files)).hexdigest()

            cache = self.cache_includes or (current.cache.ram, 60 * 5)

            def call_minify(files=files):
                return minify.minify(files,
                                     URL('static', 'temp'),
                                     current.request.folder,
                                     self.optimize_css,
                                     self.optimize_js)
            if cache:
                cache_model, time_expire = cache
                files = cache_model('response.files.minified/' + key,
                                    call_minify,
                                    time_expire)
            else:
                files = call_minify()
        s = ''
        for item in files:
            if isinstance(item, str):
                f = item.lower().split('?')[0]
                if self.static_version:
                    item = item.replace(
                        '/static/', '/static/_%s/' % self.static_version, 1)
                if f.endswith('.css'):
                    s += css_template % item
                elif f.endswith('.js'):
                    s += js_template % item
                elif f.endswith('.coffee'):
                    s += coffee_template % item
                elif f.endswith('.ts'):
                    # http://www.typescriptlang.org/
                    s += typescript_template % item
                elif f.endswith('.less'):
                    s += less_template % item
            elif isinstance(item, (list, tuple)):
                f = item[0]
                if f == 'css:inline':
                    s += css_inline % item[1]
                elif f == 'js:inline':
                    s += js_inline % item[1]
        self.write(s, escape=False)
dataset/ETHPy150Open uwdata/termite-data-server/web2py/gluon/globals.py/Response.include_files/original