Commits

Anonymous committed 5a0c929

export spliting ext to the independent function

Comments (0)

Files changed (1)

 
     return ''.join(b)
 
+def split_ext(filename):
+    """
+    Return tuple of filename and extenstion.
+    """
+    l = filename.rpartition('.')
+    return (l[0], l[2])
+
 def gen_url(fname):
     hashsum = hashlib.md5();
     hashsum.update(open(fname).read(10485760))
     def add_file(l, directory, files):
         for f in files:
             path = os.path.join(directory, f)
-            if os.path.isfile(path) and \
-                                f.rpartition('.')[2].lower() in FILE_FORMATS:
+            if os.path.isfile(path) and split_ext(f)[1].lower() in FILE_FORMATS:
                 l.append(path)
 
     l = []