Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jgiannelos
maps-deduped-tilelist
Commits
63efcde4
Commit
63efcde4
authored
Jan 12, 2022
by
Jgiannelos
Browse files
Serialize OSM element when logging
parent
44d0a9c6
Pipeline
#1473
passed with stages
in 2 minutes and 27 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
wmfmaps/changeset/verifier.py
View file @
63efcde4
...
...
@@ -15,6 +15,18 @@ class ElementHandler:
self
.
failfast
=
failfast
self
.
inconsistencies
=
[]
def
serialize
(
self
,
change
):
tags
=
{}
for
tag
in
change
.
tags
:
tags
[
tag
.
k
]
=
tag
.
v
return
{
"id"
:
change
.
id
,
"changeset"
:
change
.
changeset
,
"version"
:
change
.
version
,
"tags"
:
tags
,
}
def
exists
(
self
,
table
,
osm_id
):
query
=
f
"SELECT * FROM
{
table
}
WHERE osm_id =
{
osm_id
}
"
cursor
=
self
.
conn
.
cursor
()
...
...
@@ -29,7 +41,7 @@ class ElementHandler:
f
"Element with id:
{
change
.
id
}
shouldn't exist"
)
self
.
inconsistencies
.
append
(
{
"type"
:
"should be deleted"
,
"
id"
:
change
.
id
}
{
"type"
:
"should be deleted"
,
"
element"
:
self
.
serialize
(
change
)
}
)
break
...
...
@@ -45,7 +57,9 @@ class ElementHandler:
raise
InconsistentChangeException
(
f
"Element with id:
{
change
.
id
}
should exist"
)
self
.
inconsistencies
.
append
({
"type"
:
"should exist"
,
"id"
:
change
.
id
})
self
.
inconsistencies
.
append
(
{
"type"
:
"should exist"
,
"element"
:
self
.
serialize
(
change
)}
)
def
log_inconsistencies
(
self
):
for
elem
in
self
.
inconsistencies
:
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment