From 8e8560dcb4d9e796156df8bfaad6564a555e2724 Mon Sep 17 00:00:00 2001 From: makkalot Date: Sun, 3 Aug 2008 00:12:11 +0300 Subject: fix for jobthing to tolerate the weird and long names for globs in database related with async job_ids --- func/utils.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'func/utils.py') diff --git a/func/utils.py b/func/utils.py index 0e4b4d5..628694d 100755 --- a/func/utils.py +++ b/func/utils.py @@ -29,4 +29,26 @@ def is_error(result): return False - +def remove_weird_chars(dirty_word): + """ + That method will be used to clean some + glob adress expressions because async stuff + depends on that part + + @param dirty_word : word to be cleaned + """ + from copy import copy + copy_word = copy(dirty_word) + copy_word = copy_word.replace("-","_") + return copy_word + +def get_formated_jobid(**id_pack): + import time + import pprint + + glob = remove_weird_chars(id_pack['spec']) + module = remove_weird_chars(id_pack['module']) + method = remove_weird_chars(id_pack['method']) + job_id = "".join([glob,"-",module,"-",method,"-",pprint.pformat(time.time())]) + return job_id + -- cgit