Skip to content
This repository has been archived by the owner on Dec 7, 2022. It is now read-only.
/ pulp Public archive

Commit

Permalink
Merge pull request #2032 from bmbouter/only-move-file-unit-to-final-p…
Browse files Browse the repository at this point in the history
…lace-once

Causes a single set_content() call to only save files once
  • Loading branch information
bmbouter committed Oct 6, 2015
2 parents bb11031 + 41f7cd9 commit 60e79b9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions server/pulp/server/db/model/__init__.py
Expand Up @@ -562,6 +562,7 @@ def pre_save_signal(cls, sender, document, **kwargs):
return
with FileStorage() as storage:
storage.put(document, document._source_location)
document._source_location = None

def set_content(self, source_location):
"""
Expand Down
3 changes: 2 additions & 1 deletion server/test/unit/server/db/test_model.py
Expand Up @@ -231,7 +231,8 @@ def test_pre_save_signal(self, close, _open, put):
base.assert_called_once_with(sender, unit, **kwargs)
_open.assert_called_once_with()
close.assert_called_once_with()
put.assert_called_once_with(unit, unit._source_location)
put.assert_called_once_with(unit, '1234')
self.assertEqual(unit._source_location, None)

@patch('pulp.server.db.model.FileStorage.put')
@patch('pulp.server.db.model.FileStorage.open')
Expand Down

0 comments on commit 60e79b9

Please sign in to comment.