Commits

Julian Rosse  committed 1b687d7

oops

  • Participants
  • Parent commits 5c40fab
  • Branches optional

Comments (0)

Files changed (1)

File sleepy/templates/sleepy/util.mako

             from os import listdir
             from os.path import join
             import re
-            _filename_re = re.compile( """
-                                        . *
-                                        -
-                                        (
-                                         \d + )
-                                        \.css
-                                       """,
-                                       re.X )
         %>
         % if config.get( "sleepy.versioned_css" ):
             <%
-                max_version = max( _filename_re
-                                    .match( stylesheet )
-                                    .group( 1 )
-                                    for stylesheet
-                                    in listdir( join( config[ "pylons.paths" ]
-                                                            [ "static_files" ],
-                                                       "css" ))
-                                    if _filename_re.match( stylesheet ))
-                name = ( name
-                          + "-"
-                          + str( max_version ))
+                _filename_re = re.compile( """
+                                            . *
+                                           """
+                                            + name
+                                            + """
+                                               -
+                                               (
+                                                \d + )
+                                               \.css
+                                              """,
+                                           re.X )
+                matches = [ _filename_re
+                             .match( stylesheet )
+                             .group( 1 )
+                             for stylesheet
+                             in listdir( join( config[ "pylons.paths" ]
+                                                     [ "static_files" ],
+                                                "css" ))
+                             if _filename_re.match( stylesheet ) ]
+                if len( matches ):
+                    max_version = max( matches )
+                    name = ( name
+                              + "-"
+                              + str( max_version ))
             %>
         % endif
         <link