|
| 1 | +import os |
1 | 2 | import re
|
2 | 3 | import uuid
|
3 | 4 |
|
@@ -31,31 +32,29 @@ def get_isolation_level_display(engine, level):
|
31 | 32 | if engine == 'psycopg2':
|
32 | 33 | import psycopg2.extensions
|
33 | 34 | choices = {
|
34 |
| - psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT: 'Autocommit', |
35 |
| - psycopg2.extensions.ISOLATION_LEVEL_READ_UNCOMMITTED: 'Read uncommitted', |
36 |
| - psycopg2.extensions.ISOLATION_LEVEL_READ_COMMITTED: 'Read committed', |
37 |
| - psycopg2.extensions.ISOLATION_LEVEL_REPEATABLE_READ: 'Repeatable read', |
38 |
| - psycopg2.extensions.ISOLATION_LEVEL_SERIALIZABLE: 'Serializable', |
| 35 | + psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT: _('Autocommit'), |
| 36 | + psycopg2.extensions.ISOLATION_LEVEL_READ_UNCOMMITTED: _('Read uncommitted'), |
| 37 | + psycopg2.extensions.ISOLATION_LEVEL_READ_COMMITTED: _('Read committed'), |
| 38 | + psycopg2.extensions.ISOLATION_LEVEL_REPEATABLE_READ: _('Repeatable read'), |
| 39 | + psycopg2.extensions.ISOLATION_LEVEL_SERIALIZABLE: _('Serializable'), |
39 | 40 | }
|
40 | 41 | else:
|
41 | 42 | raise ValueError(engine)
|
42 |
| - |
43 | 43 | return choices.get(level)
|
44 | 44 |
|
45 | 45 |
|
46 | 46 | def get_transaction_status_display(engine, level):
|
47 | 47 | if engine == 'psycopg2':
|
48 | 48 | import psycopg2.extensions
|
49 | 49 | choices = {
|
50 |
| - psycopg2.extensions.TRANSACTION_STATUS_IDLE: 'Idle', |
51 |
| - psycopg2.extensions.TRANSACTION_STATUS_ACTIVE: 'Active', |
52 |
| - psycopg2.extensions.TRANSACTION_STATUS_INTRANS: 'In transaction', |
53 |
| - psycopg2.extensions.TRANSACTION_STATUS_INERROR: 'In error', |
54 |
| - psycopg2.extensions.TRANSACTION_STATUS_UNKNOWN: 'Unknown', |
| 50 | + psycopg2.extensions.TRANSACTION_STATUS_IDLE: _('Idle'), |
| 51 | + psycopg2.extensions.TRANSACTION_STATUS_ACTIVE: _('Active'), |
| 52 | + psycopg2.extensions.TRANSACTION_STATUS_INTRANS: _('In transaction'), |
| 53 | + psycopg2.extensions.TRANSACTION_STATUS_INERROR: _('In error'), |
| 54 | + psycopg2.extensions.TRANSACTION_STATUS_UNKNOWN: _('Unknown'), |
55 | 55 | }
|
56 | 56 | else:
|
57 | 57 | raise ValueError(engine)
|
58 |
| - |
59 | 58 | return choices.get(level)
|
60 | 59 |
|
61 | 60 |
|
@@ -126,10 +125,9 @@ def nav_subtitle(self):
|
126 | 125 |
|
127 | 126 | def title(self):
|
128 | 127 | count = len(self._databases)
|
129 |
| - |
130 |
| - return __('SQL Queries from %(count)d connection', 'SQL Queries from %(count)d connections', count) % dict( |
131 |
| - count=count, |
132 |
| - ) |
| 128 | + return __('SQL Queries from %(count)d connection', |
| 129 | + 'SQL Queries from %(count)d connections', |
| 130 | + count) % dict(count=count) |
133 | 131 |
|
134 | 132 | def url(self):
|
135 | 133 | return ''
|
|
0 commit comments