mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-21 13:50:20 +08:00
merging heads
This commit is contained in:
@@ -105,6 +105,8 @@ class UniverseWebTransaction( base.DefaultWebTransaction ):
|
||||
self.app = app
|
||||
self.webapp = webapp
|
||||
self.security = webapp.security
|
||||
# FIXME: the following 3 attributes are not currently used
|
||||
# Remove them if they are not going to be...
|
||||
self.__user = NOT_SET
|
||||
self.__history = NOT_SET
|
||||
self.__galaxy_session = NOT_SET
|
||||
@@ -178,9 +180,17 @@ class UniverseWebTransaction( base.DefaultWebTransaction ):
|
||||
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
|
||||
@@ -191,8 +201,10 @@ class UniverseWebTransaction( base.DefaultWebTransaction ):
|
||||
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) )
|
||||
# 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:
|
||||
@@ -248,6 +260,7 @@ class UniverseWebTransaction( base.DefaultWebTransaction ):
|
||||
|
||||
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,
|
||||
|
||||
@@ -24,7 +24,7 @@ log = logging.getLogger( __name__ )
|
||||
# server (for running the tests against a running instance)
|
||||
|
||||
default_galaxy_test_host = "localhost"
|
||||
default_galaxy_test_port = "9999"
|
||||
default_galaxy_test_port = "9879"
|
||||
galaxy_test_file_dir = "test-data"
|
||||
server = None
|
||||
app = None
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env python
|
||||
#Retreives data from GMOD and stores in a file. GBrowse parameters are provided in the input/output file.
|
||||
import urllib, sys, os, gzip, tempfile, shutil
|
||||
|
||||
assert sys.version_info[:2] >= ( 2, 4 )
|
||||
|
||||
def stop_err( msg ):
|
||||
sys.stderr.write( msg )
|
||||
sys.exit()
|
||||
|
||||
def __main__():
|
||||
filename = sys.argv[1]
|
||||
params = {}
|
||||
|
||||
for line in open( filename, 'r' ):
|
||||
try:
|
||||
line = line.strip()
|
||||
fields = line.split( '\t' )
|
||||
params[ fields[0] ] = fields[1]
|
||||
except:
|
||||
continue
|
||||
|
||||
URL = params.get( 'URL', None )
|
||||
if not URL:
|
||||
open( filename, 'w' ).write( "" )
|
||||
stop_err( 'Datasource has not sent back a URL parameter.' )
|
||||
|
||||
for i, param in enumerate( params.keys() ):
|
||||
if i == 0:
|
||||
sep = '?'
|
||||
else:
|
||||
sep = '&'
|
||||
if param != '__collected_datasets__':
|
||||
URL += "%s%s=%s" % ( sep, param, params.get( param ) )
|
||||
|
||||
CHUNK_SIZE = 2**20 # 1Mb
|
||||
try:
|
||||
page = urllib.urlopen( URL )
|
||||
except Exception, exc:
|
||||
raise Exception( 'Problems connecting to %s (%s)' % ( URL, exc ) )
|
||||
sys.exit( 1 )
|
||||
|
||||
fp = open( filename, 'wb' )
|
||||
while 1:
|
||||
chunk = page.read( CHUNK_SIZE )
|
||||
if not chunk:
|
||||
break
|
||||
fp.write( chunk )
|
||||
fp.close()
|
||||
|
||||
if __name__ == "__main__": __main__()
|
||||
Reference in New Issue
Block a user