#NEWLINE# def get( self ) : #NEWLINE# #INDENT# 'Handler to redirect all /_ah/admin.* requests to Admin Console.' #NEWLINE# app_id = self . request . environ . get ( APPLICATION_ID_PARAM ) #NEWLINE# if ( not app_id ) : #NEWLINE# #INDENT# logging . error ( 'Could not get application id; generic redirect.' ) #NEWLINE# self . redirect ( APPENGINE_URL ) #NEWLINE# return #NEWLINE# #UNINDENT# server = self . request . environ . get ( SERVER_NAME_PARAM ) #NEWLINE# if ( not server ) : #NEWLINE# #INDENT# logging . warning ( 'Server parameter not present; appengine.com redirect.' ) #NEWLINE# self . redirect ( ( '%s%s%s' % ( APPENGINE_URL , CONSOLE_SUFFIX , app_id ) ) ) #NEWLINE# return #NEWLINE# #UNINDENT# if server . endswith ( GOOGLE_SUFFIX ) : #NEWLINE# #INDENT# if ( server . find ( app_id ) == 0 ) : #NEWLINE# #INDENT# new_server = server . replace ( app_id , ADMIN_CONSOLE_NAME ) #NEWLINE# self . redirect ( ( 'http://%s%s%s' % ( new_server , CONSOLE_SUFFIX , app_id ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . response . out . write ( '\n          Could not determine admin console location from server name.' ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# self . redirect ( ( '%s%s%s' % ( APPENGINE_URL , CONSOLE_SUFFIX , app_id ) ) )