From 949778e70293033f40014375ac04c52b974982c8 Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Mon, 8 Sep 2008 15:11:49 -0700 Subject: [PATCH] Fixed a bug in which Luminotes Desktop file attachment did not always work due to incorrect upload progress reporting. --- controller/Files.py | 4 +++- controller/test/Test_files.py | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/controller/Files.py b/controller/Files.py index 64633f8..e48416d 100644 --- a/controller/Files.py +++ b/controller/Files.py @@ -681,7 +681,9 @@ class Files( object ): rate_plan = self.__users.rate_plan( user.rate_plan ) - if user.storage_bytes + uploading_file.content_length > rate_plan.get( u"storage_quota_bytes", 0 ) * SOFT_QUOTA_FACTOR: + storage_quota_bytes = rate_plan.get( u"storage_quota_bytes" ) + if storage_quota_bytes and \ + user.storage_bytes + uploading_file.content_length > storage_quota_bytes * SOFT_QUOTA_FACTOR: return stream_quota_error() return stream_progress( uploading_file, filename, fraction_reported ) diff --git a/controller/test/Test_files.py b/controller/test/Test_files.py index 0af5955..90cf732 100644 --- a/controller/test/Test_files.py +++ b/controller/test/Test_files.py @@ -1315,6 +1315,10 @@ class Test_files( Test_controller ): self.assert_streaming_error( result, u"quota" ) + def test_progress_no_quota( self ): + self.settings[ u"global" ][ u"luminotes.rate_plans" ][ 1 ][ u"storage_quota_bytes" ] = None + self.test_progress() + def test_stats( self ): self.login() orig_storage_bytes = self.user.storage_bytes