Merge branch 'master' of git+ssh://dev.laptop.org/git/sugar
This commit is contained in:
commit
e31bcc76b3
@ -4,6 +4,7 @@ sugardir = $(pkgdatadir)/shell/view
|
|||||||
sugar_PYTHON = \
|
sugar_PYTHON = \
|
||||||
__init__.py \
|
__init__.py \
|
||||||
ActivityHost.py \
|
ActivityHost.py \
|
||||||
|
BuddyActivityView.py \
|
||||||
ConsoleWindow.py \
|
ConsoleWindow.py \
|
||||||
FirstTimeDialog.py \
|
FirstTimeDialog.py \
|
||||||
BuddyIcon.py \
|
BuddyIcon.py \
|
||||||
|
@ -18,12 +18,12 @@ class GObjectSingletonMeta(gobject.GObjectMeta):
|
|||||||
klass.__instance = gobject.GObjectMeta.__call__(klass, *args, **kwargs)
|
klass.__instance = gobject.GObjectMeta.__call__(klass, *args, **kwargs)
|
||||||
return klass.__instance
|
return klass.__instance
|
||||||
|
|
||||||
def _stringify_sha(sha_hash):
|
def printable_hash(in_hash):
|
||||||
"""Convert binary sha1 hash data into printable characters."""
|
"""Convert binary hash data into printable characters."""
|
||||||
print_sha = ""
|
printable = ""
|
||||||
for char in sha_hash:
|
for char in in_hash:
|
||||||
print_sha = print_sha + binascii.b2a_hex(char)
|
printable = printable + binascii.b2a_hex(char)
|
||||||
return print_sha
|
return printable
|
||||||
|
|
||||||
def _sha_data(data):
|
def _sha_data(data):
|
||||||
"""sha1 hash some bytes."""
|
"""sha1 hash some bytes."""
|
||||||
@ -33,7 +33,7 @@ def _sha_data(data):
|
|||||||
|
|
||||||
def unique_id(data = ''):
|
def unique_id(data = ''):
|
||||||
data_string = "%s%s%s" % (time.time(), random.randint(10000, 100000), data)
|
data_string = "%s%s%s" % (time.time(), random.randint(10000, 100000), data)
|
||||||
return _stringify_sha(_sha_data(data_string))
|
return printable_hash(_sha_data(data_string))
|
||||||
|
|
||||||
|
|
||||||
ACTIVITY_ID_LEN = 40
|
ACTIVITY_ID_LEN = 40
|
||||||
|
Loading…
Reference in New Issue
Block a user