Merge lp:~thisfred/ubuntuone-client/fix-stale-notification into lp:ubuntuone-client

Proposed by Eric Casteleijn
Status: Merged
Approved by: Natalia Bidart
Approved revision: 1169
Merged at revision: 1167
Proposed branch: lp:~thisfred/ubuntuone-client/fix-stale-notification
Merge into: lp:ubuntuone-client
Diff against target: 73 lines (+28/-6)
2 files modified
tests/status/test_aggregator.py (+20/-0)
ubuntuone/status/aggregator.py (+8/-6)
To merge this branch: bzr merge lp:~thisfred/ubuntuone-client/fix-stale-notification
Reviewer Review Type Date Requested Status
Natalia Bidart (community) Approve
Alejandro J. Cura (community) Approve
Review via email: mp+84843@code.launchpad.net

Commit message

Uploading filename is now reset on every message display.

Description of the change

Uploading filename is now reset on every message display.

To post a comment you must log in.
Revision history for this message
Alejandro J. Cura (alecu) wrote :

Looks fine, and tests pass.

review: Approve
Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Can you please use os.path.basename instead of splitting the path? Thanks!

The rest looks good, and works like a charm.

review: Needs Fixing
1167. By Eric Casteleijn

used os.filename and os.basename

1168. By Eric Casteleijn

remerged trunk

1169. By Eric Casteleijn

used os.path.basename everywhere

Revision history for this message
Eric Casteleijn (thisfred) wrote :

changed code to use os.path.basename everywhere

Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Looks good!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'tests/status/test_aggregator.py'
--- tests/status/test_aggregator.py 2011-10-27 13:47:09 +0000
+++ tests/status/test_aggregator.py 2011-12-12 22:53:26 +0000
@@ -1327,6 +1327,26 @@
1327 result = self.aggregator.get_discovery_message()1327 result = self.aggregator.get_discovery_message()
1328 self.assertEqual(expected, result)1328 self.assertEqual(expected, result)
13291329
1330 def test_get_discovery_message_clears_filenames(self):
1331 """Test the message that's shown on the discovery bubble."""
1332 uploading = 10
1333 downloading = 8
1334 filename = 'upfile0.ext'
1335 filename2 = 'downfile0.ext'
1336 self.aggregator.files_uploading.extend([
1337 FakeCommand(path='upfile%d.ext' % n) for n in range(uploading)])
1338 self.aggregator.uploading_filename = filename
1339 self.aggregator.files_downloading.extend([
1340 FakeCommand(path='downfile%d.ext' % n) for n in
1341 range(downloading)])
1342 self.aggregator.downloading_filename = 'STALE FILENAME'
1343 self.aggregator.uploading_filename = 'STALE FILENAME'
1344 expected = (
1345 aggregator.files_being_uploaded(filename, uploading) + "\n" +
1346 aggregator.files_being_downloaded(filename2, downloading))
1347 result = self.aggregator.get_discovery_message()
1348 self.assertEqual(expected, result)
1349
1330 def test_get_final_status_message(self):1350 def test_get_final_status_message(self):
1331 """The final status message."""1351 """The final status message."""
1332 done = (5, 10)1352 done = (5, 10)
13331353
=== modified file 'ubuntuone/status/aggregator.py'
--- ubuntuone/status/aggregator.py 2011-10-21 15:49:18 +0000
+++ ubuntuone/status/aggregator.py 2011-12-12 22:53:26 +0000
@@ -646,12 +646,14 @@
646 lines = []646 lines = []
647 files_uploading = len(self.files_uploading)647 files_uploading = len(self.files_uploading)
648 if files_uploading > 0:648 if files_uploading > 0:
649 self.uploading_filename = os.path.basename(
650 self.files_uploading[0].path)
649 lines.append(files_being_uploaded(651 lines.append(files_being_uploaded(
650 self.uploading_filename, files_uploading))652 self.uploading_filename, files_uploading))
651 files_downloading = len(self.files_downloading)653 files_downloading = len(self.files_downloading)
652 if files_downloading > 0:654 if files_downloading > 0:
653 self.downloading_filename = self.files_downloading[0].path.split(655 self.downloading_filename = os.path.basename(
654 os.path.sep)[-1]656 self.files_downloading[0].path)
655 lines.append(files_being_downloaded(657 lines.append(files_being_downloaded(
656 self.downloading_filename, files_downloading))658 self.downloading_filename, files_downloading))
657 return "\n".join(lines)659 return "\n".join(lines)
@@ -712,8 +714,8 @@
712 (command.share_id, command.node_id)] = command.deflated_size714 (command.share_id, command.node_id)] = command.deflated_size
713 # pylint: disable=W0201715 # pylint: disable=W0201
714 if not self.downloading_filename:716 if not self.downloading_filename:
715 self.downloading_filename = self.files_downloading[0].path.split(717 self.downloading_filename = os.path.basename(
716 os.path.sep)[-1]718 self.files_downloading[0].path)
717 # pylint: enable=W0201719 # pylint: enable=W0201
718 self.update_progressbar()720 self.update_progressbar()
719 logger.debug(721 logger.debug(
@@ -743,8 +745,8 @@
743 (command.share_id, command.node_id)] = command.deflated_size745 (command.share_id, command.node_id)] = command.deflated_size
744 # pylint: disable=W0201746 # pylint: disable=W0201
745 if not self.uploading_filename:747 if not self.uploading_filename:
746 self.uploading_filename = self.files_uploading[0].path.split(748 self.uploading_filename = os.path.basename(
747 os.path.sep)[-1]749 self.files_uploading[0].path)
748 # pylint: enable=W0201750 # pylint: enable=W0201
749 self.update_progressbar()751 self.update_progressbar()
750 logger.debug(752 logger.debug(

Subscribers

People subscribed via source and target branches