From 42cff5421c19314c968c6015178ecd001f3c7fea Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Mon, 16 Feb 2009 14:25:24 -0800 Subject: [PATCH] You can now copy the Luminotes Desktop URL and paste it into another web browser without getting an error message. --- NEWS | 13 ++++++++----- controller/Users.py | 4 +++- controller/test/Test_notebooks.py | 16 ++++++++++++++++ 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index 1bcff7f..4da9562 100644 --- a/NEWS +++ b/NEWS @@ -1,11 +1,14 @@ 1.6.6: ? - * Luminotes Desktop now has a "close" link at the top of the page to - completely shut down the process. - * Luminotes Desktop now attempts to always run on a particular port number, - which means that as long as it's running you can reach it from a constant - URL. * Luminotes now recognizes "mailto:" links as external links, so you can include links to email addresses within your notes. + * Several Luminotes Desktop improvements: + * There is now a "close" link at the top of the page to completely shut down + the process when you're done using Luminotes. + * Luminotes Desktop now attempts to always run on a particular port number, + which means that as long as it's running you can reach it from a constant + URL. + * You can now copy the Luminotes Desktop URL and paste it into another + web browser without getting an error message. 1.6.5: February 12, 2009 * Now ignoring even more unneeded HTML tags from an MS Word copy-and-paste. diff --git a/controller/Users.py b/controller/Users.py index 67980f8..6f150c2 100644 --- a/controller/Users.py +++ b/controller/Users.py @@ -143,8 +143,10 @@ def grab_user_id( function ): return function( *args, **kwargs ) except Access_error: # if there was an Access_error, and the user isn't logged in, and this is an HTTP GET request, - # redirect to the login page + # redirect to the login page. that is, unless there is an auto-login username if cherrypy.session.get( "user_id" ) is None and cherrypy.request.method == "GET": + if cherrypy.config.configs[ u"global" ].get( u"luminotes.auto_login_username" ): + raise cherrypy.HTTPRedirect( u"%s/" % cherrypy.request.base ) original_path = cherrypy.request.path + \ ( cherrypy.request.query_string and u"?%s" % cherrypy.request.query_string or "" ) raise cherrypy.HTTPRedirect( u"%s/login?after_login=%s" % ( cherrypy.request.base, urllib.quote( original_path ) ) ) diff --git a/controller/test/Test_notebooks.py b/controller/test/Test_notebooks.py index dd00736..8cb0fe6 100644 --- a/controller/test/Test_notebooks.py +++ b/controller/test/Test_notebooks.py @@ -165,6 +165,22 @@ class Test_notebooks( Test_controller ): user = self.database.load( User, self.user.object_id ) assert user.storage_bytes == 0 + def test_default_without_login_using_auto_login( self ): + cherrypy.config.configs[ u"global" ][ u"luminotes.auto_login_username" ] = u"someone" + + try: + path = "/notebooks/%s" % self.notebook.object_id + result = self.http_get( path ) + + headers = result.get( "headers" ) + assert headers + assert headers.get( "Location" ) == u"http:///" + + user = self.database.load( User, self.user.object_id ) + assert user.storage_bytes == 0 + finally: + del( cherrypy.config.configs[ u"global" ][ u"luminotes.auto_login_username" ] ) + def test_default_forum( self ): self.login()