From b3755127f8f0d50b5ddf3e49ad8ef38e440e62ee Mon Sep 17 00:00:00 2001 From: Greg <129239095+gcglinton@users.noreply.github.com> Date: Tue, 25 Jul 2023 17:00:08 -0400 Subject: [PATCH] Fix a couple of problems in init (#727) These were found when developing unit tests --- sarracenia/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sarracenia/__init__.py b/sarracenia/__init__.py index b4de69053..14e3337dd 100755 --- a/sarracenia/__init__.py +++ b/sarracenia/__init__.py @@ -35,6 +35,7 @@ import os import os.path import paramiko +import random import re import sarracenia.filemetadata import stat as os_stat @@ -340,7 +341,7 @@ def __computeIdentity(msg, path, o): methods = [ 'random', 'md5', 'md5name', 'sha512', 'cod,md5', 'cod,sha512' ] - calc_method = choice(methods) + calc_method = random.choice(methods) elif 'identity' in xattr.x and 'mtime' in xattr.x: if xattr.get('mtime') >= msg['mtime']: logger.debug("mtime remembered by xattr") @@ -575,7 +576,7 @@ def fromFileInfo(path, o, lstat=None): 'value': o.identity_method[4:] } elif o.identity_method in ['random']: - algo = sarracenia.identity.Indentiy.factory(o.identity_method) + algo = sarracenia.identity.Identity.factory(o.identity_method) algo.set_path(post_relPath) msg['identity'] = { 'method': o.identity_method,