#NEWLINE# @ classmethod #NEWLINE# def tornadio_initialize( cls , connection , user_settings , resource , io_loop = None , extra_re = None , extra_sep = None ) : #NEWLINE# #INDENT# 'Initialize class with the connection and resource.\n\n        Does all behind the scenes work to setup routes, etc. Partially\n        copied from SocketTornad.IO implementation.\n        ' #NEWLINE# cls . _connection = connection #NEWLINE# cls . io_loop = ( io_loop or ioloop . IOLoop . instance ( ) ) #NEWLINE# settings = DEFAULT_SETTINGS . copy ( ) #NEWLINE# if ( user_settings is not None ) : #NEWLINE# #INDENT# settings . update ( user_settings ) #NEWLINE# #UNINDENT# cls . settings = settings #NEWLINE# cls . _sessions = session . SessionContainer ( ) #NEWLINE# check_interval = ( settings [ 'session_check_interval' ] * 1000 ) #NEWLINE# cls . _sessions_cleanup = ioloop . PeriodicCallback ( cls . _sessions . expire , check_interval , cls . io_loop ) . start ( ) #NEWLINE# if extra_re : #NEWLINE# #INDENT# if ( not extra_re . startswith ( '(?P<extra>' ) ) : #NEWLINE# #INDENT# extra_re = ( '(?P<extra>%s)' % extra_re ) #NEWLINE# #UNINDENT# if extra_sep : #NEWLINE# #INDENT# extra_re = ( extra_sep + extra_re ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# extra_re = '(?P<extra>)' #NEWLINE# #UNINDENT# proto_re = '|' . join ( PROTOCOLS . keys ( ) ) #NEWLINE# cls . _route = ( ( '/(?P<resource>%s)%s/(?P<protocol>%s)/?(?P<session_id>[0-9a-zA-Z]*)/?(?P<protocol_init>\\d*?)|(?P<xhr_path>\\w*?)/?(?P<jsonp_index>\\d*?)' % ( resource , extra_re , settings ) ) , cls )