-
Notifications
You must be signed in to change notification settings - Fork 509
Closed
Labels
Description
When using the data export feature, registration documents (receipts, etc..) are currently not included
We'd probably just need to extend this function:
indico/indico/modules/users/export.py
Lines 167 to 173 in 61aacd1
| def get_registration_files(user): | |
| """Get all files uploaded in registration file fields.""" | |
| return (RegistrationData.query | |
| .join(Registration) | |
| .filter(Registration.user == user, | |
| RegistrationData.filename.isnot(None)) | |
| .all()) |
..and add a new case to the storage path builder:
indico/indico/modules/users/export.py
Lines 291 to 320 in 61aacd1
| def build_storage_path(file): | |
| """Build a path under which a given file be stored in the exported zip file. | |
| The path includes both the id (to ensure uniqueness) and the title/name for | |
| easy navigation. | |
| """ | |
| if isinstance(file, RegistrationData): | |
| event = file.registration.event | |
| prefix = 'registrations' | |
| path = f'{event.id}_{event.title}' | |
| elif isinstance(file, AttachmentFile): | |
| prefix = 'attachments' | |
| path = '' | |
| elif isinstance(file, AbstractFile): | |
| event = file.abstract.event | |
| prefix = 'abstracts' | |
| path = f'{event.id}_{event.title}/{file.abstract.id}_{file.abstract.title}' | |
| elif isinstance(file, PaperFile): | |
| event = file._contribution.event | |
| prefix = 'papers' | |
| path = f'{event.id}_{event.title}/{file._contribution.id}_{file.paper.title}' | |
| else: | |
| editable = file.revision.editable | |
| event = editable.contribution.event | |
| prefix = f'editables/{editable.type.name}' | |
| path = f'{event.id}_{event.title}/{editable.id}_{editable.contribution.title}' | |
| path = secure_path(path) | |
| filename = build_filename(file) | |
| return str(Path() / prefix / path / filename) |