Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework SIP Package generation and download #5837

Merged
merged 6 commits into from
Jul 29, 2019
Merged

Conversation

phgross
Copy link
Member

@phgross phgross commented Jul 24, 2019

This is the first part of the work we do for #5167, a short summary of the changes this PR does.

  • Rework SIP Package generation and download. Store SIP package as a blob locally instead of re generating them for each download. This solves time and ressources and makes it possible to provide customer specific scripts and SIP package handling.
  • Switch SIP download button to the download view. The export view stays still available, but is no longer available trough the UI, can be useful for debugging purposes.
  • Instead of a manual trigger, generate and store the SIP Package automatically, when disposing a disposition.
  • Remove local copy of the SIP package after closing a disposition.

Checkliste

Zutreffendes soll angehakt stehengelassen werden.

  • Gibt es neue Übersetzungen?
  • Changelog-Eintrag vorhanden/nötig?
  • Aktualisierung Dokumentation vorhanden/nötig? Nicht notwendig, das sich für den Benutzer nichts ändert. Es handelt sich hier ausschliesslich um technische Anpassungen.

@phgross phgross added this to the Sprint #3 milestone Jul 24, 2019
@phgross phgross requested a review from a team July 24, 2019 12:59
Copy link
Contributor

@deiferni deiferni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some suggestions/comments, 👍 apart from that!

opengever/disposition/browser/ech0160.py Outdated Show resolved Hide resolved
package = SIPPackage(self)
zip_file = self.create_zipfile(package)
zip_file.seek(0)
return NamedBlobFile(zip_file.read(), contentType='application/zip')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you could pass a reference to the file instead of reading the file into memory yourself. That triggers an plone.namedfile.interfaces.IStorage adapter, which should be able to handle the file instance. If we are lucky it can be moved on the filesystem without reading the whole thing into memory. Not 100% sure but worth a try.

Copy link
Member Author

@phgross phgross Jul 25, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not found a way to pass in a file in to a NamedBlobFile, we would need to register a IStorage Adapter for __builtin__.file what I'm not sure is the right way. For now i did no change.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as discussed today, if it does not work by default i'm ok with not changing the current implementation 👍.

"""

def __call__(self):
self.context.store_sip_package()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This view will respond to a GET request. do you see a way to create a form which only responds to an i.e. POST, as it will modify data in the database.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll do the maintenance-actions as discussed in a separate PR, I added a checkbox to the Main Issue.

Copy link
Contributor

@deiferni deiferni Jul 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i have added a checkbox to the main issue in #5167.

opengever/disposition/browser/overview.py Show resolved Hide resolved
@phgross phgross force-pushed the pg_disposition_store branch 3 times, most recently from 06f8153 to d31a58f Compare July 25, 2019 15:37
Store SIP package as a blob locally instead of re generating them for each
download. This solves time and ressources and makes it possible to
provide customer specific scripts and SIP package handling.
The export view stays still available, but is no longer available
trough the UI, can be useful for debugging purposes.
@phgross
Copy link
Member Author

phgross commented Jul 25, 2019

@deiferni updated according to your feedback. The maintenance-action I'll do in a separate PR.

Copy link
Contributor

@deiferni deiferni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@deiferni deiferni merged commit ccc3073 into master Jul 29, 2019
@deiferni deiferni deleted the pg_disposition_store branch July 29, 2019 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants