lib/utils.py
changeset 23 10841abbc01f
parent 20 6c774496bb00
child 26 81d6679d50d0
equal deleted inserted replaced
22:72696ca68c34 23:10841abbc01f
    17 # Free Software Foundation, Inc.,
    17 # Free Software Foundation, Inc.,
    18 # 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
    18 # 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
    19 #
    19 #
    20 
    20 
    21 import os.path
    21 import os.path
       
    22 
       
    23 import settings
       
    24 
       
    25 def isImage (fname) :
       
    26     """
       
    27         Is the given filename likely to be an image file?
       
    28     """
       
    29 
       
    30     fname = fname.lower()
       
    31     base, ext = os.path.splitext(fname)
       
    32     ext = ext.lstrip('.')
       
    33 
       
    34     return ext in settings.IMAGE_EXTS
    22 
    35 
    23 def readFile (path) :
    36 def readFile (path) :
    24     fo = open(path, 'r')
    37     fo = open(path, 'r')
    25     data = fo.read()
    38     data = fo.read()
    26     fo.close()
    39     fo.close()