witten
/
luminotes
Archived
1
0
Fork 0

Demo accounts cannot share their notebook anymore (but free accounts can).

This commit is contained in:
Dan Helfman 2007-12-11 06:28:56 +00:00
parent 02444c81cc
commit a4a6667642
3 changed files with 26 additions and 3 deletions

View File

@ -691,7 +691,7 @@ class Users( object ):
# this feature requires a rate plan above basic
user = self.__database.load( User, user_id )
if user is None or ( user.rate_plan == 0 and access != u"viewer" ):
if user is None or user.username is None or ( user.rate_plan == 0 and access != u"viewer" ):
raise Access_error()
if access == u"collaborator":
@ -746,7 +746,7 @@ class Users( object ):
message[ u"To" ] = email_address
message[ u"Subject" ] = notebook_name
message.set_payload(
u"I've shared a wiki with you called \"%s\"\n" % notebook_name +
u"I've shared a wiki with you called: %s\n" % notebook_name +
u"Please visit the following link to view it online:\n\n" +
u"%s/i/%s\n\n" % ( self.__https_url or self.__http_url, invite.object_id )
)

View File

@ -1109,6 +1109,29 @@ class Test_users( Test_controller ):
assert result[ u"error" ]
def test_send_invites_without_username( self ):
Stub_smtp.reset()
smtplib.SMTP = Stub_smtp
self.login()
self.user._User__username = None
self.user.rate_plan = 1
self.database.save( self.user )
email_addresses_list = [ u"foo@example.com" ]
email_addresses = email_addresses_list[ 0 ]
result = self.http_post( "/users/send_invites", dict(
notebook_id = self.notebooks[ 0 ].object_id,
email_addresses = email_addresses,
access = u"viewer",
invite_button = u"send invites",
), session_id = self.session_id )
session_id = result[ u"session_id" ]
assert result[ u"error" ]
assert "access" in result[ u"error" ]
def test_send_invites_without_any_access( self ):
Stub_smtp.reset()
smtplib.SMTP = Stub_smtp

View File

@ -75,7 +75,7 @@ class Link_area( Div ):
class_ = u"link_area_item",
),
( notebook.owner ) and Div(
( notebook.owner and user.username ) and Div(
A(
u"share",
href = u"#",