Gentoo Archives: gentoo-commits

From: Devan Franchini <twitch153@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/webapp-config:master commit in: WebappConfig/
Date: Tue, 29 Oct 2013 02:15:15
Message-Id: 1383012838.a7b03c25292bfad034c8ef91a8f6f50199bc67e8.twitch153@gentoo
1 commit: a7b03c25292bfad034c8ef91a8f6f50199bc67e8
2 Author: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
3 AuthorDate: Sat Oct 19 03:24:15 2013 +0000
4 Commit: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
5 CommitDate: Tue Oct 29 02:13:58 2013 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/webapp-config.git;a=commit;h=a7b03c25
7
8 WebappConfig/compat.py: Revamps create_md5() function.
9
10 This second revamp changes the way in which python is opening
11 the file to create an md5 hash of. Upon calling the open()
12 function it opens the file to read it, or as a binary. This
13 allows for consistent behavior when trying to open either a
14 binary file, or a text file to hash. This method is also much
15 cleaner and sufficient for forward and backwards compatibility.
16
17 Conflicts:
18 WebappConfig/compat.py
19
20 ---
21 WebappConfig/compat.py | 7 ++++++-
22 1 file changed, 6 insertions(+), 1 deletion(-)
23
24 diff --git a/WebappConfig/compat.py b/WebappConfig/compat.py
25 index 536bb2a..526b1bc 100644
26 --- a/WebappConfig/compat.py
27 +++ b/WebappConfig/compat.py
28 @@ -15,13 +15,18 @@
29 #
30 # ========================================================================
31
32 -import hashlib, os, os.path, sys
33 +import hashlib
34
35 def create_md5(filename):
36 +<<<<<<< HEAD
37 if hex(sys.hexversion) >= '0x3020000':
38 filename = open(filename).read()
39 encoded_file = filename.encode('utf8')
40 return str(hashlib.md5(encoded_file).hexdigest())
41 else:
42 return str(hashlib.md5(open(filename).read()).hexdigest())
43 +=======
44 + with open(filename, 'rb') as f:
45 + return str(hashlib.md5(f.read()).hexdigest())
46 +>>>>>>> 04e9a55... WebappConfig/compat.py: Revamps create_md5() function.