/[qa]/trunk/pts/www/bin/common.py
ViewVC logotype

Diff of /trunk/pts/www/bin/common.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2049 by zack, Fri Nov 28 16:53:12 2008 UTC revision 2050 by zack, Fri Nov 28 16:59:31 2008 UTC
# Line 3  Line 3 
3    
4  # Copyright 2002 Raphaël Hertzog  # Copyright 2002 Raphaël Hertzog
5  # Copyright 2006 Jeroen van Wolffelaar  # Copyright 2006 Jeroen van Wolffelaar
6    # Copyright 2007-2008 Stefano Zacchiroli
7  # This file is distributed under the terms of the General Public License  # This file is distributed under the terms of the General Public License
8  # version 2 or (at your option) any later version.  # version 2 or (at your option) any later version.
9    
10  import os, os.path, re, rfc822, time, email  import md5, os, os.path, re, rfc822, time, email
11  from email import Utils, Header  from email import Utils, Header
12    
13  from config import root  from config import root
# Line 129  def ensure_utf8(str): Line 130  def ensure_utf8(str):
130          str = str.decode("latin1")          str = str.decode("latin1")
131      return str      return str
132    
133    def md5sum_file(fname):
134        """returns md5sum hash in hex for the given file"""
135        f = open(fname,"r")
136        if not f: return 0
137    
138        hash = md5.new()
139        for line in f.readlines():
140            hash.update(line)
141        f.close()
142    
143        return hash.hexdigest()
144    
145  # Version Control Systems table  # Version Control Systems table
146  # Fields:  # Fields:
147  #   'tag' is as it would appear in a vcs-XXX field, e.g. 'svn' for Vcs-Svn  #   'tag' is as it would appear in a vcs-XXX field, e.g. 'svn' for Vcs-Svn

Legend:
Removed from v.2049  
changed lines
  Added in v.2050

  ViewVC Help
Powered by ViewVC 1.1.5