<s> """<STR_LIT>""" <EOL> import logging <EOL> from core . controllers import admin <EOL> from core . controllers import base <EOL> from core . controllers import collection_editor <EOL> from core . controllers import collection_viewer <EOL> from core . controllers import editor <EOL> from core . controllers import feedback <EOL> from core . controllers import galleries <EOL> from core . controllers import home <EOL> from core . controllers import moderator <EOL> from core . controllers import pages <EOL> from core . controllers import profile <EOL> from core . controllers import reader <EOL> from core . controllers import recent_commits <EOL> from core . controllers import resources <EOL> from core . domain import user_services <EOL> from core . platform import models <EOL> import feconf <EOL> from mapreduce import main as mapreduce_main <EOL> from mapreduce import parameters as mapreduce_parameters <EOL> import webapp2 <EOL> from webapp2_extras . routes import RedirectRoute <EOL> transaction_services = models . Registry . import_transaction_services ( ) <EOL> class FrontendErrorHandler ( base . BaseHandler ) : <EOL> """<STR_LIT>""" <EOL> REQUIRE_PAYLOAD_CSRF_CHECK = False <EOL> def post ( self ) : <EOL> """<STR_LIT>""" <EOL> logging . error ( '<STR_LIT>' % self . payload . get ( '<STR_LIT:error>' ) ) <EOL> self . render_json ( self . values ) <EOL> class WarmupHandler ( base . BaseHandler ) : <EOL> """<STR_LIT>""" <EOL> def get ( self ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class HomePageRedirectHandler ( base . BaseHandler ) : <EOL> "<STR_LIT>" <EOL> def get ( self ) : <EOL> if self . user_id and user_services . has_fully_registered ( self . user_id ) : <EOL> self . redirect ( feconf . MY_EXPLORATIONS_URL ) <EOL> else : <EOL> self . redirect ( feconf . GALLERY_URL ) <EOL> def get_redirect_route ( regex_route , handler , name , defaults = None ) : <EOL> """<STR_LIT>""" <EOL> if defaults is None : <EOL> defaults = { } <EOL> return RedirectRoute ( <EOL> regex_route , handler , name , strict_slash = True , defaults = defaults ) <EOL> def authorization_wrapper ( self , * args , ** kwargs ) : <EOL> if '<STR_LIT>' not in self . request . headers : <EOL> self . response . out . write ( '<STR_LIT>' ) <EOL> self . response . set_status ( <NUM_LIT> ) <EOL> return <EOL> self . real_dispatch ( * args , ** kwargs ) <EOL> def ui_access_wrapper ( self , * args , ** kwargs ) : <EOL> self . real_dispatch ( * args , ** kwargs ) <EOL> MAPREDUCE_HANDLERS = [ ] <EOL> for path , handler_class in mapreduce_main . create_handlers_map ( ) : <EOL> if path . startswith ( '<STR_LIT>' ) : <EOL> if '<STR_LIT>' in path or path == '<STR_LIT>' : <EOL> path = path . replace ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> else : <EOL> path = path . replace ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> else : <EOL> if '<STR_LIT>' in path : <EOL> path = path . replace ( '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:1> ) <EOL> elif '<STR_LIT>' in path : <EOL> continue <EOL> else : <EOL> path = path . replace ( '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:1> ) <EOL> if '<STR_LIT>' in path or path . endswith ( '<STR_LIT>' ) : <EOL> if ( hasattr ( handler_class , '<STR_LIT>' ) and <EOL> not hasattr ( handler_class , '<STR_LIT>' ) ) : <EOL> handler_class . real_dispatch = handler_class . dispatch <EOL> handler_class . dispatch = ui_access_wrapper <EOL> MAPREDUCE_HANDLERS . append ( ( path , handler_class ) ) <EOL> else : <EOL> if ( hasattr ( handler_class , '<STR_LIT>' ) and <EOL> not hasattr ( handler_class , '<STR_LIT>' ) ) : <EOL> handler_class . real_dispatch = handler_class . dispatch <EOL> handler_class . dispatch = authorization_wrapper <EOL> MAPREDUCE_HANDLERS . append ( ( path , handler_class ) ) <EOL> mapreduce_parameters . config . BASE_PATH = '<STR_LIT>' <EOL> URLS = MAPREDUCE_HANDLERS + [ <EOL> get_redirect_route ( r'<STR_LIT>' , WarmupHandler , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' , home . NotificationsDashboardPage , <EOL> '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' , <EOL> home . NotificationsDashboardHandler , <EOL> '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' , home . MyExplorationsPage , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' , home . MyExplorationsHandler , <EOL> '<STR_LIT>' ) , <EOL> get_redirect_route ( r'<STR_LIT>' , pages . AboutPage , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' , pages . ParticipatePage , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' , pages . ParticipatePage , <EOL> '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' , pages . AboutPage , '<STR_LIT>' ) , <EOL> get_redirect_route ( r'<STR_LIT>' , pages . ForumPage , '<STR_LIT>' ) , <EOL> get_redirect_route ( r'<STR_LIT>' , pages . TermsPage , '<STR_LIT>' ) , <EOL> get_redirect_route ( r'<STR_LIT>' , pages . PrivacyPage , '<STR_LIT>' ) , <EOL> get_redirect_route ( r'<STR_LIT>' , admin . AdminPage , '<STR_LIT>' ) , <EOL> get_redirect_route ( r'<STR_LIT>' , admin . AdminHandler , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' , admin . AdminJobOutput , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' , <EOL> admin . AdminTopicsCsvDownloadHandler , <EOL> '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' , <EOL> resources . ImageHandler , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' , <EOL> resources . ObjectEditorTemplateHandler , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' , <EOL> resources . ValueGeneratorHandler , '<STR_LIT>' ) , <EOL> get_redirect_route ( r'<STR_LIT:/>' , HomePageRedirectHandler , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT:%s>' % feconf . GALLERY_URL , galleries . GalleryPage , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT:%s>' % feconf . GALLERY_DATA_URL , galleries . GalleryHandler , <EOL> '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT:%s>' % feconf . LEARN_GALLERY_URL , galleries . GalleryRedirectPage , <EOL> '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT:%s>' % feconf . PLAYTEST_QUEUE_URL , galleries . GalleryRedirectPage , <EOL> '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT:%s>' % feconf . CONTRIBUTE_GALLERY_URL , galleries . GalleryRedirectPage , <EOL> '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT:%s>' % feconf . NEW_EXPLORATION_URL , <EOL> galleries . NewExploration , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT:%s>' % feconf . NEW_COLLECTION_URL , <EOL> galleries . NewCollection , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT:%s>' % feconf . UPLOAD_EXPLORATION_URL , <EOL> galleries . UploadExploration , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> feconf . EXPLORATION_SUMMARIES_DATA_URL , <EOL> galleries . ExplorationSummariesHandler , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' , profile . ProfilePage , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' , profile . ProfileHandler , <EOL> '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' , profile . PreferencesPage , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' , profile . PreferencesHandler , <EOL> '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' , profile . ProfilePictureHandler , <EOL> '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' , <EOL> profile . ProfilePictureHandlerByUsername , <EOL> '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT:%s>' % feconf . SIGNUP_URL , profile . SignupPage , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT:%s>' % feconf . SIGNUP_DATA_URL , profile . SignupHandler , <EOL> '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT:%s>' % feconf . USERNAME_CHECK_DATA_URL , <EOL> profile . UsernameCheckHandler , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' , moderator . ModeratorPage , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' , <EOL> moderator . EmailDraftHandler , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' % feconf . EXPLORATION_URL_PREFIX , <EOL> reader . ExplorationPage , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' % feconf . EXPLORATION_INIT_URL_PREFIX , <EOL> reader . ExplorationHandler , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' , <EOL> reader . ExplorationStartEventHandler , <EOL> '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' , <EOL> reader . StateHitEventHandler , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' , <EOL> reader . AnswerSubmittedEventHandler , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' , <EOL> reader . ReaderFeedbackHandler , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' , <EOL> reader . ExplorationCompleteEventHandler , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' , <EOL> reader . ExplorationMaybeLeaveHandler , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' , reader . ClassifyHandler , <EOL> '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' , <EOL> reader . RatingHandler , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' , <EOL> reader . RecommendationsHandler , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' % feconf . EDITOR_URL_PREFIX , <EOL> editor . ExplorationPage , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' , editor . ExplorationHandler , <EOL> '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' , <EOL> editor . ChangeListSummaryHandler , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' , <EOL> editor . ExplorationDownloadHandler , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' , <EOL> editor . StateDownloadHandler , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' , <EOL> editor . ImageUploadHandler , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' + <EOL> r'<STR_LIT>' , <EOL> editor . ResolvedAnswersHandler , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' , <EOL> editor . UntrainedAnswersHandler , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' , <EOL> editor . ExplorationResourcesHandler , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' , <EOL> editor . ExplorationRevertHandler , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' % feconf . EXPLORATION_RIGHTS_PREFIX , <EOL> editor . ExplorationRightsHandler , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' , <EOL> editor . ExplorationModeratorRightsHandler , <EOL> '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' , <EOL> editor . ExplorationSnapshotsHandler , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' , <EOL> editor . ExplorationStatsVersionsHandler , <EOL> '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' , <EOL> editor . ExplorationStatisticsHandler , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' + <EOL> r'<STR_LIT>' , <EOL> editor . StateRulesStatsHandler , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' , <EOL> editor . StartedTutorialEventHandler , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT:%s>' % feconf . RECENT_COMMITS_DATA_URL , <EOL> recent_commits . RecentCommitsHandler , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT:%s>' % feconf . RECENT_FEEDBACK_MESSAGES_DATA_URL , <EOL> feedback . RecentFeedbackMessagesHandler , <EOL> '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' % feconf . FEEDBACK_THREADLIST_URL_PREFIX , <EOL> feedback . ThreadListHandler , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' % feconf . FEEDBACK_THREAD_URL_PREFIX , <EOL> feedback . ThreadHandler , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' % feconf . FEEDBACK_STATS_URL_PREFIX , <EOL> feedback . FeedbackStatsHandler , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' % feconf . SUGGESTION_URL_PREFIX , <EOL> feedback . SuggestionHandler , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' % <EOL> feconf . SUGGESTION_ACTION_URL_PREFIX , <EOL> feedback . SuggestionActionHandler , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' % feconf . SUGGESTION_LIST_URL_PREFIX , <EOL> feedback . SuggestionListHandler , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' % feconf . COLLECTION_URL_PREFIX , <EOL> collection_viewer . CollectionPage , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' % feconf . COLLECTION_DATA_URL_PREFIX , <EOL> collection_viewer . CollectionDataHandler , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' % feconf . COLLECTION_EDITOR_URL_PREFIX , <EOL> collection_editor . CollectionEditorPage , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' % feconf . COLLECTION_WRITABLE_DATA_URL_PREFIX , <EOL> collection_editor . WritableCollectionDataHandler , <EOL> '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' % feconf . COLLECTION_RIGHTS_PREFIX , <EOL> collection_editor . CollectionRightsHandler , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' , home . NotificationsHandler , <EOL> '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' , FrontendErrorHandler , '<STR_LIT>' ) , <EOL> get_redirect_route ( <EOL> r'<STR_LIT>' , base . LogoutPage , '<STR_LIT>' ) , <EOL> get_redirect_route ( r'<STR_LIT>' , base . Error404Handler , '<STR_LIT>' ) , <EOL> ] <EOL> app = transaction_services . toplevel_wrapper ( <EOL> webapp2 . WSGIApplication ( URLS , debug = feconf . DEBUG ) ) </s>
