From 85745d8a715fb04a1d1f5cf6c777043c99c4916d Mon Sep 17 00:00:00 2001 From: Alexei Date: Sun, 30 Apr 2023 09:28:26 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9A=D0=BE=D0=BC=D0=BC=D0=B5=D0=BD=D1=82?= =?UTF-8?q?=D0=B0=D1=80=D0=B8=D0=B8=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0?= =?UTF-8?q?=D1=8E=D1=82.=20=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B8=D0=BB?= =?UTF-8?q?=D0=B0=D1=81=D1=8C=20=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D1=8F?= =?UTF-8?q?=20=D1=85=D0=B5=D1=88=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- template/bd_item.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/template/bd_item.py b/template/bd_item.py index 3a30a01..1c6e1e0 100644 --- a/template/bd_item.py +++ b/template/bd_item.py @@ -10,13 +10,9 @@ from template import simple_message from aiogram import types -''' -class TableListParam(): - def __init__(self, a_TableName : str, a_KeyName : str, a_GetButtonNameAndKeyValueAndAccessFunc): - self.table_name = a_TableName - self.key_name = a_KeyName - self.get_bname_and_key_value_func = a_GetButtonNameAndKeyValueAndAccessFunc -''' +import hashlib +def md5(a_Str): + return hashlib.md5(a_Str.encode('utf-8')).hexdigest() item_not_found = 'Элемент {item_id} не найден в таблице {a_TableName}' skip_button_name = "⏩ Пропустить" @@ -24,10 +20,8 @@ canсel_button_name = "🚫 Отменить" def HashPrefix(a_Str): # callback data в сообщении имеет ограниченную длину, поэтому сокращаем префикс - summ = 0 - for i in a_Str: - summ += ord(i) - return f'{summ}:' + #log.Info(f'HashPrefix {md5(a_Str)[0:8]}: - {a_Str}') + return f'{md5(a_Str)[0:8]}:' class FieldType(Enum): text = 'text'