File tree Expand file tree Collapse file tree 5 files changed +11
-6
lines changed Expand file tree Collapse file tree 5 files changed +11
-6
lines changed Original file line number Diff line number Diff line change 1
1
from .connectors import Connector
2
+ from .connection import Connection
2
3
from .cursor import OperationalError
Original file line number Diff line number Diff line change 2
2
3
3
4
4
class Connection :
5
- def __init__ (self , path , connector ):
5
+ def __init__ (self , path , connector_class ):
6
6
self .path = path
7
- self .connector = connector
7
+ self .connector_class = connector_class
8
8
9
9
def execute (self , * args , ** kwargs ):
10
10
cursor = Cursor (self )
Original file line number Diff line number Diff line change @@ -32,8 +32,12 @@ class Connector:
32
32
connector_type = None
33
33
connection_class = Connection
34
34
35
- def connect (self , path ):
36
- return self .connection_class (path , self )
35
+ @classmethod
36
+ def connect (cls , path ):
37
+ return cls .connection_class (path , cls )
38
+
39
+ def __init__ (self , conn ):
40
+ self .conn = conn
37
41
38
42
def table_names (self ):
39
43
"""
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ class QueryNotSupported(Exception):
14
14
15
15
def __init__ (self , conn ):
16
16
self .conn = conn
17
- self .connector = conn .connector
17
+ self .connector = conn .connector_class ( conn )
18
18
self .rows = []
19
19
self .description = ()
20
20
Original file line number Diff line number Diff line change 1
1
from datasette_connectors import monkey ; monkey .patch_datasette ()
2
2
from datasette_connectors .connectors import ConnectorList
3
3
from .dummy import DummyConnector
4
- ConnectorList .add_connector ('dummy' , DummyConnector () )
4
+ ConnectorList .add_connector ('dummy' , DummyConnector )
5
5
6
6
from datasette .app import Datasette
7
7
from datasette .utils .testing import TestClient
You can’t perform that action at this time.
0 commit comments