@@ -153,7 +153,7 @@ def srcset(*args, **kwargs):
153
153
if Path (image .name ).suffix .lower () == ".svg" :
154
154
return svg_srcset (image )
155
155
156
- # Get the conf from the first arg or default
156
+ # Get the conf from the config kwarg or default
157
157
try :
158
158
conf = settings .LAZY_SRCSET [kwargs .pop ("config" )]
159
159
except KeyError :
@@ -164,7 +164,7 @@ def srcset(*args, **kwargs):
164
164
165
165
# Set the maximum width image in our srcset.
166
166
if max_width is None or max_width > image .width :
167
- # Clamp max_width to image.width or use image.width if max_width is None.
167
+ # Limit max_width to image.width or use image.width if max_width is None.
168
168
max_width = image .width
169
169
170
170
# Get the format and quality from kwargs or conf and wrap up together with source in generator_kwargs.
@@ -188,8 +188,8 @@ def srcset(*args, **kwargs):
188
188
generator_image = ImageCacheFile (generator )
189
189
190
190
# Set the max_width image as our src and include it in the srcset.
191
- src = generator_image .url
192
- srcset = [FORMAT_STRINGS ["srcset_entry" ] % (generator_image .url , max_width )]
191
+ src_value = generator_image .url
192
+ srcset_values = [FORMAT_STRINGS ["srcset_entry" ] % (generator_image .url , max_width )]
193
193
194
194
# Set the width and height from the max_width image.
195
195
width , height = generator_image .width , generator_image .height
@@ -222,15 +222,15 @@ def srcset(*args, **kwargs):
222
222
generator_image = ImageCacheFile (generator )
223
223
224
224
# Add an entry for this image to the srcset.
225
- srcset .append (
225
+ srcset_values .append (
226
226
FORMAT_STRINGS ["srcset_entry" ] % (generator_image .url , target_width )
227
227
)
228
228
229
229
# Create the attrs list for imminent stringification.
230
230
attrs = [
231
- FORMAT_STRINGS ["src" ] % src ,
232
- FORMAT_STRINGS ["srcset" ] % ", " .join (srcset ),
233
- FORMAT_STRINGS ["sizes" ] % ", " .join (sizes ),
231
+ FORMAT_STRINGS ["src" ] % src_value ,
232
+ FORMAT_STRINGS ["srcset" ] % ", " .join (srcset_values ),
233
+ FORMAT_STRINGS ["sizes" ] % ", " .join (reversed ( sizes ) ),
234
234
FORMAT_STRINGS ["width" ] % width ,
235
235
FORMAT_STRINGS ["height" ] % height ,
236
236
]
0 commit comments