Browse Source

Fixed a bug that broke that Luminotes Desktop product download page if PayPal took too long to notify Luminotes of the purchase.

Dan Helfman 10 years ago
parent
commit
815b05e574
4 changed files with 22 additions and 5 deletions
  1. 2
    0
      NEWS
  2. 1
    1
      controller/Users.py
  3. 10
    1
      controller/test/Test_users.py
  4. 9
    3
      view/Processing_download_note.py

+ 2
- 0
NEWS View File

@@ -3,6 +3,8 @@
3 3
    * You can now create and end links.
4 4
    * Underline and strikethrough now work.
5 5
    * Pulldowns for search suggestions, importing, and exporting show up.
6
+ * Fixed a bug that broke that Luminotes Desktop product download page if
7
+   PayPal took too long to notify Luminotes of the purchase.
6 8
 
7 9
 1.5.2: October 1, 2008
8 10
  * Leading/trailing spaces in note titles are now ignored when making links

+ 1
- 1
controller/Users.py View File

@@ -1636,7 +1636,7 @@ class Users( object ):
1636 1636
       result[ "conversion" ] = "download_%s" % item_number
1637 1637
     # otherwise, display an auto-reloading "processing..." page
1638 1638
     else:
1639
-      note = Processing_download_note( download_access_id, retry_count )
1639
+      note = Processing_download_note( download_access_id, tx, retry_count )
1640 1640
 
1641 1641
     result[ "notebook" ] = main_notebook
1642 1642
     result[ "startup_notes" ] = self.__database.select_many( Note, main_notebook.sql_load_startup_notes() )

+ 10
- 1
controller/test/Test_users.py View File

@@ -1750,7 +1750,6 @@ class Test_users( Test_controller ):
1750 1750
       invite_button = u"send invites",
1751 1751
     ), session_id = self.session_id )
1752 1752
     
1753
-    print result
1754 1753
     invites = result[ u"invites" ]
1755 1754
     assert len( invites ) == 2
1756 1755
     invite = invites[ 0 ]
@@ -4463,6 +4462,8 @@ class Test_users( Test_controller ):
4463 4462
     assert result[ u"notes" ][ 0 ].notebook_id == self.anon_notebook.object_id
4464 4463
     assert u"being processed" in result[ u"notes" ][ 0 ].contents
4465 4464
     assert u"retry_count=1" in result[ u"notes" ][ 0 ].contents
4465
+    assert u'<meta content="2; URL=/users/thanks_download?access_id=%s&retry_count=1" http-equiv="Refresh"></meta>' % access_id \
4466
+           in result[ u"notes" ][ 0 ].contents
4466 4467
 
4467 4468
   def test_thanks_download_not_yet_paid_with_retry( self ):
4468 4469
     access_id = u"wheeaccessid"
@@ -4509,6 +4510,8 @@ class Test_users( Test_controller ):
4509 4510
     assert result[ u"notes" ][ 0 ].notebook_id == self.anon_notebook.object_id
4510 4511
     assert u"being processed" in result[ u"notes" ][ 0 ].contents
4511 4512
     assert u"retry_count=4" in result[ u"notes" ][ 0 ].contents
4513
+    assert u'<meta content="2; URL=/users/thanks_download?access_id=%s&retry_count=4" http-equiv="Refresh"></meta>' % access_id \
4514
+           in result[ u"notes" ][ 0 ].contents
4512 4515
 
4513 4516
   def test_thanks_download_not_yet_paid_with_retry_timeout( self ):
4514 4517
     access_id = u"wheeaccessid"
@@ -4555,6 +4558,7 @@ class Test_users( Test_controller ):
4555 4558
     assert result[ u"notes" ][ 0 ].notebook_id == self.anon_notebook.object_id
4556 4559
     assert u"Thank you" in result[ u"notes" ][ 0 ].contents
4557 4560
     assert u"confirmation" in result[ u"notes" ][ 0 ].contents
4561
+    assert u"<meta " not in result[ u"notes" ][ 0 ].contents
4558 4562
 
4559 4563
   def test_thanks_download_not_yet_paid_tx( self ):
4560 4564
     access_id = u"wheeaccessid"
@@ -4600,6 +4604,8 @@ class Test_users( Test_controller ):
4600 4604
     assert result[ u"notes" ][ 0 ].notebook_id == self.anon_notebook.object_id
4601 4605
     assert u"being processed" in result[ u"notes" ][ 0 ].contents
4602 4606
     assert u"retry_count=1" in result[ u"notes" ][ 0 ].contents
4607
+    assert u'<meta content="2; URL=/users/thanks_download?tx=%s&retry_count=1" http-equiv="Refresh"></meta>' % transaction_id \
4608
+           in result[ u"notes" ][ 0 ].contents
4603 4609
 
4604 4610
   def test_thanks_download_not_yet_paid_tx_with_retry( self ):
4605 4611
     access_id = u"wheeaccessid"
@@ -4647,6 +4653,8 @@ class Test_users( Test_controller ):
4647 4653
     assert result[ u"notes" ][ 0 ].notebook_id == self.anon_notebook.object_id
4648 4654
     assert u"being processed" in result[ u"notes" ][ 0 ].contents
4649 4655
     assert u"retry_count=4" in result[ u"notes" ][ 0 ].contents
4656
+    assert u'<meta content="2; URL=/users/thanks_download?tx=%s&retry_count=4" http-equiv="Refresh"></meta>' % transaction_id \
4657
+           in result[ u"notes" ][ 0 ].contents
4650 4658
 
4651 4659
   def test_thanks_download_not_yet_paid_tx_with_retry_timeout( self ):
4652 4660
     access_id = u"wheeaccessid"
@@ -4693,6 +4701,7 @@ class Test_users( Test_controller ):
4693 4701
     assert result[ u"notes" ][ 0 ].notebook_id == self.anon_notebook.object_id
4694 4702
     assert u"Thank you" in result[ u"notes" ][ 0 ].contents
4695 4703
     assert u"confirmation" in result[ u"notes" ][ 0 ].contents
4704
+    assert u"<meta " not in result[ u"notes" ][ 0 ].contents
4696 4705
 
4697 4706
   def test_thanks_download_missing_tx_missing_access_id( self ):
4698 4707
     self.login()

+ 9
- 3
view/Processing_download_note.py View File

@@ -2,19 +2,25 @@ from Tags import Html, Head, Meta, H3, P
2 2
 
3 3
 
4 4
 class Processing_download_note( Html ):
5
-  def __init__( self, download_access_id, retry_count ):
5
+  def __init__( self, access_id = None, tx = None, retry_count = None ):
6 6
     if not retry_count:
7 7
       retry_count = 0
8 8
 
9 9
     retry_count += 1
10 10
 
11
+    if tx:
12
+      meta_content = u"2; URL=/users/thanks_download?tx=%s&retry_count=%s" % ( tx, retry_count )
13
+    elif access_id:
14
+      meta_content = u"2; URL=/users/thanks_download?access_id=%s&retry_count=%s" % ( access_id, retry_count )
15
+    else:
16
+      raise Exception( u"either tx or access_id required" ) 
17
+
11 18
     Html.__init__(
12 19
       self,
13 20
       Head(
14 21
         Meta(
15 22
           http_equiv = u"Refresh",
16
-          content = u"2; URL=/users/thanks_download?access_id=%s&retry_count=%s" %
17
-                    ( download_access_id, retry_count ),
23
+          content = meta_content,
18 24
         ),
19 25
       ),
20 26
       H3( u"processing..." ),

Loading…
Cancel
Save