First pass at "thank you" page (and related processing/error pages) is complete.
This commit is contained in:
parent
948c1cd059
commit
f6538ad3a5
|
@ -18,6 +18,9 @@ from view.Main_page import Main_page
|
|||
from view.Redeem_reset_note import Redeem_reset_note
|
||||
from view.Redeem_invite_note import Redeem_invite_note
|
||||
from view.Blank_page import Blank_page
|
||||
from view.Thanks_note import Thanks_note
|
||||
from view.Thanks_error_note import Thanks_error_note
|
||||
from view.Processing_note import Processing_note
|
||||
|
||||
|
||||
USERNAME_PATTERN = re.compile( "^[a-zA-Z0-9]+$" )
|
||||
|
@ -978,8 +981,6 @@ class Users( object ):
|
|||
PAYPAL_URL = u"https://www.sandbox.paypal.com/cgi-bin/webscr"
|
||||
#PAYPAL_URL = u"https://www.paypal.com/cgi-bin/webscr"
|
||||
|
||||
print params
|
||||
|
||||
# check that payment_status is Completed
|
||||
payment_status = params.get( u"payment_status" )
|
||||
if payment_status and payment_status != u"Completed":
|
||||
|
@ -1067,6 +1068,52 @@ class Users( object ):
|
|||
|
||||
return dict()
|
||||
|
||||
@expose()
|
||||
def thanks( self ):
|
||||
pass # TODO
|
||||
@expose( view = Main_page )
|
||||
@grab_user_id
|
||||
def thanks( self, **params ):
|
||||
"""
|
||||
Provide the information necessary to display the subscription thanks page.
|
||||
"""
|
||||
anonymous = self.__database.select_one( User, User.sql_load_by_username( u"anonymous" ) )
|
||||
if anonymous:
|
||||
main_notebook = self.__database.select_one( Notebook, anonymous.sql_load_notebooks( undeleted_only = True ) )
|
||||
else:
|
||||
main_notebook = None
|
||||
|
||||
result = self.current( params.get( u"user_id" ) )
|
||||
|
||||
rate_plan = params.get( u"item_number", "" )
|
||||
try:
|
||||
rate_plan = int( rate_plan )
|
||||
except ValueError:
|
||||
rate_plan = None
|
||||
|
||||
retry_count = params.get( u"retry_count", "" )
|
||||
try:
|
||||
retry_count = int( retry_count )
|
||||
except ValueError:
|
||||
retry_count = None
|
||||
|
||||
# if there's no rate plan or we've retried too many times, give up and display an error
|
||||
RETRY_TIMEOUT = 30
|
||||
if rate_plan is None or retry_count > RETRY_TIMEOUT:
|
||||
note = Thanks_error_note()
|
||||
# if the rate plan of the subscription matches the user's current rate plan, success
|
||||
elif rate_plan == result[ u"user" ].rate_plan:
|
||||
note = Thanks_note( self.__rate_plans[ rate_plan ][ u"name" ].capitalize() )
|
||||
# otherwise, display an auto-reloading "processing..." page
|
||||
else:
|
||||
note = Processing_note( rate_plan, retry_count )
|
||||
|
||||
result[ "notebook" ] = main_notebook
|
||||
result[ "startup_notes" ] = self.__database.select_many( Note, main_notebook.sql_load_startup_notes() )
|
||||
result[ "total_notes_count" ] = self.__database.select_one( Note, main_notebook.sql_count_notes() )
|
||||
result[ "note_read_write" ] = False
|
||||
result[ "notes" ] = [ Note.create(
|
||||
object_id = u"thanks",
|
||||
contents = unicode( note ),
|
||||
notebook_id = main_notebook.object_id,
|
||||
) ]
|
||||
result[ "invites" ] = []
|
||||
|
||||
return result
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# prevent bots from signing up for demo accounts
|
||||
User-agent: *
|
||||
Disallow: /users/demo
|
||||
Disallow: /users/thanks
|
||||
Disallow: /notebooks/download_html/
|
||||
|
||||
# this crawler is completely broken and requests many invalid URLs
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
from Tags import Html, Head, Meta, H3, P
|
||||
|
||||
|
||||
class Processing_note( Html ):
|
||||
def __init__( self, rate_plan, retry_count ):
|
||||
if not retry_count:
|
||||
retry_count = 0
|
||||
|
||||
retry_count += 1
|
||||
|
||||
Html.__init__(
|
||||
self,
|
||||
Head(
|
||||
Meta(
|
||||
http_equiv = u"Refresh",
|
||||
content = u"2; URL=/users/thanks?item_number=%s&retry_count=%s" % ( rate_plan, retry_count ),
|
||||
),
|
||||
),
|
||||
H3( u"processing..." ),
|
||||
P(
|
||||
"""
|
||||
Your subscription is being processed. This shouldn't take more than a minute. Please wait...
|
||||
""",
|
||||
),
|
||||
)
|
|
@ -0,0 +1,33 @@
|
|||
from Tags import Span, H3, P, A
|
||||
|
||||
|
||||
class Thanks_error_note( Span ):
|
||||
def __init__( self ):
|
||||
Span.__init__(
|
||||
self,
|
||||
H3( u"thank you" ),
|
||||
P(
|
||||
u"""
|
||||
Thank you for upgrading your Luminotes account!
|
||||
""",
|
||||
),
|
||||
P(
|
||||
u"""
|
||||
Luminotes has not yet received confirmation of your subscription. If your
|
||||
account is not automatically upgraded within the next few minutes, please
|
||||
""",
|
||||
A( u"contact support", href = u"/contact_info", target = "_top" ),
|
||||
u"""
|
||||
for assistance.
|
||||
""",
|
||||
),
|
||||
P(
|
||||
u"""
|
||||
Note: You can check the current status of your account by refreshing the
|
||||
""",
|
||||
A( u"upgrade", href = u"/upgrade", target = "_top" ),
|
||||
u"""
|
||||
page while logged in.
|
||||
"""
|
||||
),
|
||||
)
|
|
@ -0,0 +1,31 @@
|
|||
from Tags import Span, H3, P, A
|
||||
|
||||
|
||||
class Thanks_note( Span ):
|
||||
def __init__( self, rate_plan_name ):
|
||||
Span.__init__(
|
||||
self,
|
||||
H3( u"thank you" ),
|
||||
P(
|
||||
u"""
|
||||
Thank you for upgrading your Luminotes account!
|
||||
""",
|
||||
),
|
||||
P(
|
||||
u"""
|
||||
Your account has been upgraded to Luminotes %s. Please click on
|
||||
one of your notebooks to the right to get started with your newly
|
||||
upgraded wiki.
|
||||
""" % rate_plan_name,
|
||||
),
|
||||
P(
|
||||
u"""
|
||||
If you have any questions about your upgraded wiki, or anything else,
|
||||
please
|
||||
""",
|
||||
A( u"contact support", href = u"/contact_info", target = "_top" ),
|
||||
u"""
|
||||
for assistance.
|
||||
""",
|
||||
),
|
||||
)
|
|
@ -62,10 +62,10 @@ class Upgrade_note( Span ):
|
|||
id = u"upgrade_table_area",
|
||||
),
|
||||
|
||||
user and user.rate_plan > 0 and P(
|
||||
user and P(
|
||||
u"You're currently subscribed to Luminotes %s." %
|
||||
rate_plans[ user.rate_plan ][ u"name" ].capitalize(),
|
||||
unsubscribe_button,
|
||||
( user.rate_plan > 0 ) and unsubscribe_button or None,
|
||||
) or None,
|
||||
|
||||
H3( u"share your notebook" ),
|
||||
|
|
Reference in New Issue