This repository has been archived on 2024-11-30. You can view files and clone it, but cannot push or open issues or pull requests.
PyBitmessage-2024-11-30/src/helper_sent.py
navjot e60d12ddbf
Refactord the uuid creation code and placed it in helper_sent.insert method
refactored on the bases of comments

Fixed CQ of src.helper_sent module

fixed CQ for helper_sent module
2020-11-21 13:53:10 +05:30

22 lines
647 B
Python

"""
Insert values into sent table
"""
import uuid
from bmconfigparser import BMConfigParser
from helper_sql import sqlExecute
def insert(t):
"""Perform an insert into the `sent` table"""
if not t[0] or not t[-1]:
temp = list(t)
if not t[0]:
print('zero index is not available')
temp[0] = uuid.uuid4().bytes # if msgid is empty the put uuid
if not t[-1]:
print('Lasr index is not available')
temp[-1] = BMConfigParser().getint('bitmessagesettings', 'ttl')
t = tuple(temp)
sqlExecute('''INSERT INTO sent VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)''', *t)