• R/O
  • HTTP
  • SSH
  • HTTPS

karesansui: Commit

Git repository of Karesansui.


Commit MetaInfo

Revisão1a2a3400040efce409a20d34fb0802cce1054dd4 (tree)
Hora2012-02-23 11:57:11
AutorTaizo ITO <taizo.ito@hde....>
CommiterTaizo ITO

Mensagem de Log

DeprecationWarning: the sha module is deprecated; use the hashlib module instead

Mudança Sumário

Diff

--- a/karesansui/gadget/guest.py
+++ b/karesansui/gadget/guest.py
@@ -219,7 +219,8 @@ def validates_guest_add(obj):
219219 ) and check
220220 if check:
221221 check = is_iso9660_filesystem_format(obj.input.vm_iso)
222- checker.add_error(_('"%s" is not valid ISO 9660 CD-ROM filesystem data.') % obj.input.vm_iso)
222+ if not check:
223+ checker.add_error(_('"%s" is not valid ISO 9660 CD-ROM filesystem data.') % obj.input.vm_iso)
223224
224225 if not is_param(obj.input, 'keymap'):
225226 check = False
--- a/karesansui/lib/crypt.py
+++ b/karesansui/lib/crypt.py
@@ -11,7 +11,11 @@
1111 #
1212
1313 import random
14-import sha
14+try:
15+ from hashlib import sha1 as sha
16+except:
17+ import sha
18+ from sha import sha
1519
1620 def sha1encrypt(v):
1721 """<comment-ja>
@@ -29,7 +33,7 @@ def sha1encrypt(v):
2933 for x in xrange(0,16):
3034 salt += random.choice('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789')
3135
32- r = sha.sha(v+salt).hexdigest()
36+ r = sha(v+salt).hexdigest()
3337 return r, salt
3438
3539 def sha1compare(target, plain, salt=''):
@@ -48,7 +52,7 @@ def sha1compare(target, plain, salt=''):
4852 TODO: English Comment
4953 </comment-en>
5054 """
51- x = sha.sha(plain+salt).hexdigest()
55+ x = sha(plain+salt).hexdigest()
5256 if target == x:
5357 return True
5458 else:
--- a/karesansui/lib/log/viewer.py
+++ b/karesansui/lib/log/viewer.py
@@ -17,8 +17,12 @@ import re
1717 import time
1818 import os
1919 import os.path
20-import sha
2120 import gzip
21+try:
22+ from hashlib import sha1 as sha
23+except:
24+ import sha
25+ from sha import sha
2226
2327 def read_all_log(app_log_config, max_line, start_datetime="", end_datetime="", keyword=""):
2428 lines = []
@@ -33,7 +37,7 @@ def read_all_log(app_log_config, max_line, start_datetime="", end_datetime="", k
3337 if lines is False:
3438 return False
3539 for line in lines:
36- key = sha.new(line).hexdigest()
40+ key = sha(line).hexdigest()
3741 logs.update({key: line})
3842 pattern = re.compile(log["time_pattern"])
3943 time_format = log["time_format"]
Show on old repository browser