Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
sakia
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
clients
python
sakia
Commits
4d01401d
Commit
4d01401d
authored
7 years ago
by
inso
Browse files
Options
Downloads
Patches
Plain Diff
Real fix to wrong endpoints
parent
c0d32fcc
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/sakia/data/repositories/meta.py
+20
-3
20 additions, 3 deletions
src/sakia/data/repositories/meta.py
src/sakia/data/repositories/nodes.py
+2
-11
2 additions, 11 deletions
src/sakia/data/repositories/nodes.py
with
22 additions
and
14 deletions
src/sakia/data/repositories/meta.py
+
20
−
3
View file @
4d01401d
...
@@ -2,14 +2,14 @@ import attr
...
@@ -2,14 +2,14 @@ import attr
import
os
import
os
import
logging
import
logging
import
sqlite3
import
sqlite3
from
duniterpy.documents
import
BlockUID
from
duniterpy.documents
import
BlockUID
,
MalformedDocumentError
from
.connections
import
ConnectionsRepo
from
.connections
import
ConnectionsRepo
from
.identities
import
IdentitiesRepo
from
.identities
import
IdentitiesRepo
from
.blockchains
import
BlockchainsRepo
from
.blockchains
import
BlockchainsRepo
from
.certifications
import
CertificationsRepo
from
.certifications
import
CertificationsRepo
from
.transactions
import
TransactionsRepo
,
Transaction
from
.transactions
import
TransactionsRepo
,
Transaction
from
.dividends
import
DividendsRepo
from
.dividends
import
DividendsRepo
from
.nodes
import
NodesRepo
from
.nodes
import
NodesRepo
,
Node
from
.sources
import
SourcesRepo
from
.sources
import
SourcesRepo
from
.contacts
import
ContactsRepo
from
.contacts
import
ContactsRepo
...
@@ -73,7 +73,8 @@ class SakiaDatabase:
...
@@ -73,7 +73,8 @@ class SakiaDatabase:
self
.
add_contacts
,
self
.
add_contacts
,
self
.
add_sentry_property
,
self
.
add_sentry_property
,
self
.
add_last_state_change_property
,
self
.
add_last_state_change_property
,
self
.
refactor_transactions
self
.
refactor_transactions
,
self
.
drop_incorrect_nodes
]
]
def
upgrade_database
(
self
,
to
=
0
):
def
upgrade_database
(
self
,
to
=
0
):
...
@@ -151,6 +152,22 @@ class SakiaDatabase:
...
@@ -151,6 +152,22 @@ class SakiaDatabase:
with
self
.
conn
:
with
self
.
conn
:
self
.
conn
.
executescript
(
sql_file
.
read
())
self
.
conn
.
executescript
(
sql_file
.
read
())
def
drop_incorrect_nodes
(
self
):
self
.
_logger
.
debug
(
"
Drop incorrect nodes
"
)
with
self
.
conn
:
c
=
self
.
conn
.
execute
(
"
SELECT * FROM nodes
"
)
data
=
c
.
fetchone
()
while
data
:
try
:
Node
(
*
data
)
except
MalformedDocumentError
:
self
.
_logger
.
debug
(
"
Dropping node {0}
"
.
format
(
data
[
1
]))
self
.
conn
.
execute
(
"""
DELETE FROM nodes
WHERE
currency=? AND pubkey=?
"""
,
(
data
[
0
],
data
[
1
]))
finally
:
data
=
c
.
fetchone
()
def
version
(
self
):
def
version
(
self
):
with
self
.
conn
:
with
self
.
conn
:
c
=
self
.
conn
.
execute
(
"
SELECT * FROM meta WHERE id=1
"
)
c
=
self
.
conn
.
execute
(
"
SELECT * FROM meta WHERE id=1
"
)
...
...
This diff is collapsed.
Click to expand it.
src/sakia/data/repositories/nodes.py
+
2
−
11
View file @
4d01401d
...
@@ -72,10 +72,7 @@ class NodesRepo:
...
@@ -72,10 +72,7 @@ class NodesRepo:
c
=
self
.
_conn
.
execute
(
request
,
tuple
(
values
))
c
=
self
.
_conn
.
execute
(
request
,
tuple
(
values
))
data
=
c
.
fetchone
()
data
=
c
.
fetchone
()
if
data
:
if
data
:
try
:
return
Node
(
*
data
)
return
Node
(
*
data
)
except
MalformedDocumentError
:
pass
def
get_all
(
self
,
**
search
):
def
get_all
(
self
,
**
search
):
"""
"""
...
@@ -101,13 +98,7 @@ class NodesRepo:
...
@@ -101,13 +98,7 @@ class NodesRepo:
c
=
self
.
_conn
.
execute
(
request
,
tuple
(
values
))
c
=
self
.
_conn
.
execute
(
request
,
tuple
(
values
))
datas
=
c
.
fetchall
()
datas
=
c
.
fetchall
()
if
datas
:
if
datas
:
nodes
=
[]
return
[
Node
(
*
data
)
for
data
in
datas
]
for
data
in
datas
:
try
:
nodes
.
append
(
Node
(
*
data
))
except
MalformedDocumentError
:
pass
return
nodes
return
[]
return
[]
def
drop
(
self
,
node
):
def
drop
(
self
,
node
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment