[hg] galaxy 1670: Some code cleanup in framework/__init__.py
details: http://www.bx.psu.edu/hg/galaxy/rev/cdb2935dc336 changeset: 1670:cdb2935dc336 user: Greg Von Kuster <greg@bx.psu.edu> date: Mon Dec 15 17:04:06 2008 -0500 description: Some code cleanup in framework/__init__.py 1 file(s) affected in this change: lib/galaxy/web/framework/__init__.py diffs (62 lines): diff -r 493a4a3ec2d8 -r cdb2935dc336 lib/galaxy/web/framework/__init__.py --- a/lib/galaxy/web/framework/__init__.py Mon Dec 15 11:25:47 2008 -0500 +++ b/lib/galaxy/web/framework/__init__.py Mon Dec 15 17:04:06 2008 -0500 @@ -25,7 +25,7 @@ import mako.lookup pkg_resources.require( "SQLAlchemy >= 0.4" ) -from sqlalchemy import desc +from sqlalchemy import and_ import logging log = logging.getLogger( __name__ ) @@ -180,17 +180,9 @@ Support for universe_session and universe_user cookies has been removed as of 31 Oct 2008. """ - #log.debug("####In __ensure_valid_session...") - #try: - # log.debug("####In __ensure_valid_session, self.galaxy_session: %s" % str( self.galaxy_session ) ) - # log.debug("####In __ensure_valid_session, self.galaxy_session.is_valid: %s" % str(self.galaxy_session.is_valid)) - #except: - # log.debug("####In __ensure_valid_session, self.galaxy_session does not yet exist...") sa_session = self.sa_session # Try to load an existing session - #log.debug("###In __ensure_valid_session, before secure_id = self.get_cookie( name='galaxysession' )...") secure_id = self.get_cookie( name='galaxysession' ) - #log.debug("###In __ensure_valid_session, secure_id: %s" % str( secure_id) ) galaxy_session = None prev_galaxy_session = None user_for_new_session = None @@ -201,10 +193,9 @@ if secure_id: # Decode the cookie value to get the session_key session_key = self.security.decode_session_key( secure_id ) - #log.debug("###In __ensure_valid_session, session_key: %s" % str( session_key) ) - # Retrive the galaxy_session id via the unique session_key - galaxy_session = sa_session.query( self.app.model.GalaxySession ).filter_by( session_key=session_key, is_valid=True ).first() - #log.debug("###In __ensure_valid_session, galaxy_session: %s" % str( galaxy_session) ) + # Retrieve the galaxy_session id via the unique session_key + galaxy_session = self.app.model.GalaxySession.filter( and_( self.app.model.GalaxySession.table.c.session_key==session_key, + self.app.model.GalaxySession.table.c.is_valid==True ) ).first() # If remote user is in use it can invalidate the session, so we need to # to check some things now. if self.app.config.use_remote_user: @@ -260,7 +251,6 @@ Caller is responsible for flushing the returned session. """ - #log.debug("###In __create_new_session...") session_key = self.security.get_new_session_key() galaxy_session = self.app.model.GalaxySession( session_key=session_key, @@ -293,8 +283,7 @@ """ Update the 'galaxysession' cookie to match the current session. """ - self.set_cookie( name='galaxysession', - value=self.security.encode_session_key( self.galaxy_session.session_key ) ) + self.set_cookie( self.security.encode_session_key( self.galaxy_session.session_key ), name='galaxysession' ) def handle_user_login( self, user ): """
participants (1)
-
Greg Von Kuster