Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 1d2add74

Přidáno uživatelem Jan Pašek před asi 4 roky(ů)

Re #8569 Removed cursor from repository constructors

Zobrazit rozdíly:

src/dao/certificate_repository.py
1
from sqlite3 import Connection, Error
1 2
from typing import Dict, List
2
from sqlite3 import Connection, Cursor, Error
3 3

  
4
from src.model.certificate import Certificate
4
from injector import inject
5

  
5 6
from src.constants import *
7
from src.model.certificate import Certificate
6 8

  
7 9

  
8 10
class CertificateRepository:
9 11

  
10
    def __init__(self, connection: Connection, cursor: Cursor):
12
    @inject
13
    def __init__(self, connection: Connection):
11 14
        """
12 15
        Constructor of the CertificateRepository object
13 16

  
14 17
        :param connection: Instance of the Connection object
15
        :param cursor: Instance of the Cursor object
16 18
        """
17

  
18 19
        self.connection = connection
19
        self.cursor = cursor
20
        self.cursor = connection.cursor()
20 21

  
21 22
    def create(self, certificate: Certificate):
22 23
        """
src/dao/private_key_repository.py
1 1
from sqlite3 import Connection, Cursor, Error
2 2
from typing import List
3 3

  
4
from injector import inject
5

  
4 6
from src.model.private_key import PrivateKey
5 7
from src.constants import *
6 8

  
7 9

  
8 10
class PrivateKeyRepository:
9 11

  
10
    def __init__(self, connection: Connection, cursor: Cursor):
12
    @inject
13
    def __init__(self, connection: Connection):
11 14
        """
12 15
        Constructor of the PrivateKeyRepository object
13 16

  
......
16 19
        """
17 20

  
18 21
        self.connection = connection
19
        self.cursor = cursor
22
        self.cursor = connection.cursor()
20 23

  
21 24
    def create(self, private_key: PrivateKey):
22 25
        """

Také k dispozici: Unified diff