Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hub
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Package registry
Operate
Terraform modules
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
thomasDOTwtf
hub
Commits
47a87400
Commit
47a87400
authored
4 months ago
by
Andreas Hubel
Browse files
Options
Downloads
Patches
Plain Diff
feat(scheduleimport): add legacy_id=drop option, so id can be recomputed from uuid
parent
bb7a9c5e
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/core/schedules/base.py
+2
-2
2 additions, 2 deletions
src/core/schedules/base.py
src/core/schedules/schedulejson.py
+6
-1
6 additions, 1 deletion
src/core/schedules/schedulejson.py
with
8 additions
and
3 deletions
src/core/schedules/base.py
+
2
−
2
View file @
47a87400
...
@@ -7,10 +7,10 @@ from django.utils import timezone
...
@@ -7,10 +7,10 @@ from django.utils import timezone
from
django.utils.module_loading
import
import_string
from
django.utils.module_loading
import
import_string
def
filter_additional_data
(
data
:
dict
,
computed_fields
:
dict
|
None
=
None
)
->
dict
:
def
filter_additional_data
(
data
:
dict
,
computed_fields
:
dict
|
None
=
None
,
others
=
[]
)
->
dict
:
computed_fields
=
computed_fields
or
{}
computed_fields
=
computed_fields
or
{}
return
{
return
{
k
:
v
for
k
,
v
in
data
.
items
()
if
(
v
and
k
not
in
[
'
guid
'
,
'
room
'
,
'
start
'
,
'
date
'
,
'
duration
'
,
'
title
'
,
'
abstract
'
,
'
description
'
,
'
language
'
])
k
:
v
for
k
,
v
in
data
.
items
()
if
(
v
and
k
not
in
[
'
guid
'
,
'
room
'
,
'
start
'
,
'
date
'
,
'
duration
'
,
'
title
'
,
'
abstract
'
,
'
description
'
,
'
language
'
,
*
others
])
}
|
computed_fields
}
|
computed_fields
...
...
This diff is collapsed.
Click to expand it.
src/core/schedules/schedulejson.py
+
6
−
1
View file @
47a87400
...
@@ -22,6 +22,7 @@ class ScheduleJSONSupport(BaseScheduleSupport):
...
@@ -22,6 +22,7 @@ class ScheduleJSONSupport(BaseScheduleSupport):
'
kind
'
:
(
'
string
'
,
'
assembly
'
,
False
,
'
kind of events, either `assembly` or `official` or `sos` or `lightning`
'
),
'
kind
'
:
(
'
string
'
,
'
assembly
'
,
False
,
'
kind of events, either `assembly` or `official` or `sos` or `lightning`
'
),
'
headers
'
:
(
'
dict
'
,
{},
False
,
'
HTTP headers to send with the request e.g. Authorization
'
),
'
headers
'
:
(
'
dict
'
,
{},
False
,
'
HTTP headers to send with the request e.g. Authorization
'
),
'
auth
'
:
(
'
string
'
,
None
,
False
,
'
HTTP Authentification header e.g. `Token 123456`
'
),
'
auth
'
:
(
'
string
'
,
None
,
False
,
'
HTTP Authentification header e.g. `Token 123456`
'
),
'
legacy_id
'
:
(
'
string
'
,
None
,
False
,
'
Use `drop` to regenerate legacy ids from the event guid, to avoid collisions with other sources
'
),
'
legacy_id_offset
'
:
(
'
int
'
,
None
,
False
,
'
Offset to add to the legacy integer `id` to avoid collisions with other sources
'
),
'
legacy_id_offset
'
:
(
'
int
'
,
None
,
False
,
'
Offset to add to the legacy integer `id` to avoid collisions with other sources
'
),
}
}
# fmt: on
# fmt: on
...
@@ -57,6 +58,10 @@ class ScheduleJSONSupport(BaseScheduleSupport):
...
@@ -57,6 +58,10 @@ class ScheduleJSONSupport(BaseScheduleSupport):
kind
=
self
.
conf_value
(
'
kind
'
)
kind
=
self
.
conf_value
(
'
kind
'
)
other_fields_to_drop
=
[]
if
self
.
conf_value
(
'
legacy_id
'
)
==
'
drop
'
:
other_fields_to_drop
.
append
(
'
id
'
)
def
ensure_full_url
(
uri
):
def
ensure_full_url
(
uri
):
if
not
uri
:
if
not
uri
:
return
None
return
None
...
@@ -85,7 +90,7 @@ class ScheduleJSONSupport(BaseScheduleSupport):
...
@@ -85,7 +90,7 @@ class ScheduleJSONSupport(BaseScheduleSupport):
'
kind
'
:
kind
,
'
kind
'
:
kind
,
'
speakers
'
:
e
.
get
(
'
persons
'
,
[]),
'
speakers
'
:
e
.
get
(
'
persons
'
,
[]),
'
banner_image_url
'
:
ensure_full_url
(
e
.
get
(
'
logo
'
)),
'
banner_image_url
'
:
ensure_full_url
(
e
.
get
(
'
logo
'
)),
'
additional_data
'
:
filter_additional_data
(
e
,
self
.
computed_data
(
e
)),
'
additional_data
'
:
filter_additional_data
(
e
,
self
.
computed_data
(
e
)
,
other_fields_to_drop
),
}
}
for
e
in
schedule
.
events
()
for
e
in
schedule
.
events
()
},
},
...
...
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