#225 Remove cache_timeout as that's deprecated
Opened 5 months ago by misc. Modified 5 months ago
misc/fedocal fix_multistatic  into  master

Remove cache_timeout as that's deprecated
Michael Scherer • 5 months ago  
file modified
+1 -5
@@ -80,10 +80,6 @@ 

          if not self.has_static_folder:

              raise RuntimeError('No static folder for this object')

  

-         # Ensure get_send_file_max_age is called in all cases.

-         # Here, we ensure get_send_file_max_age is called for Blueprints.

-         cache_timeout = self.get_send_file_max_age(filename)

- 

          folders = self.static_folder

          if isinstance(self.static_folder, string_types):

              folders = [self.static_folder]
@@ -91,7 +87,7 @@ 

          for directory in folders:

              try:

                  return send_from_directory(

-                     directory, filename, cache_timeout=cache_timeout)

+                     directory, filename)

              except NotFound:

                  pass

          raise NotFound()

This was replaced by max_age in Flask 0.9, and default to the value of
get_send_file_max_age per documentation.

Fix #223

This just removes the max age thing? Is that fine? Or am I missing how/where it happens now?

So cache_timeout is replaced by max_age in 2.1.0:
https://flask.palletsprojects.com/en/3.0.x/changes/#version-2-1-0

And the default value of max_age is the value of get_send_file_max_age()
https://flask.palletsprojects.com/en/2.3.x/api/#flask.Flask.get_send_file_max_age

So we do not need to set it, that's done by default.

Ahh, cool, seems good to merge then.

Metadata