<s> from imports import * <EOL> from config import * <EOL> from routes import * <EOL> from handlers import * <EOL> from datetime import timedelta <EOL> class RepoHandler ( BaseHandler ) : <EOL> def get ( self ) : <EOL> username = "<STR_LIT>" <EOL> fullname = "<STR_LIT>" <EOL> avatar_url = "<STR_LIT>" <EOL> if self . session . get ( '<STR_LIT:username>' ) : <EOL> username_session = self . session . get ( '<STR_LIT:username>' ) <EOL> navdata = db . GqlQuery ( "<STR_LIT>" , u = username_session ) . get ( ) <EOL> username = navdata . username <EOL> fullname = navdata . fullname <EOL> avatar_url = navdata . avatar_url <EOL> current_url = self . request . url <EOL> promoted_repo_uid = current_url . split ( '<STR_LIT:/>' ) [ <NUM_LIT:4> ] <EOL> verify = db . GqlQuery ( "<STR_LIT>" , r = promoted_repo_uid ) . fetch ( limit = <NUM_LIT:2> ) <EOL> if len ( verify ) > <NUM_LIT:0> : <EOL> clicked = self . request . cookies . get ( str ( promoted_repo_uid ) ) <EOL> repodata = db . GqlQuery ( "<STR_LIT>" , r = promoted_repo_uid ) <EOL> repodata_views = repodata . get ( ) <EOL> genre = repodata_views . genre <EOL> difficulty = repodata_views . is_beginner <EOL> if clicked != '<STR_LIT:True>' : <EOL> self . response . set_cookie ( str ( promoted_repo_uid ) , '<STR_LIT:True>' , max_age = <NUM_LIT> , path = '<STR_LIT:/>' ) <EOL> repodata_views . views_of += <NUM_LIT:1> <EOL> repodata_views . put ( ) <EOL> self . render ( '<STR_LIT>' , repodata = repodata , genre = genre , difficulty = difficulty , username = username , fullname = fullname , avatar_url = avatar_url ) <EOL> else : <EOL> self . response . out . write ( "<STR_LIT>" ) <EOL> return <EOL> class GitHubView ( BaseHandler ) : <EOL> def get ( self ) : <EOL> current_url = self . request . url <EOL> uid = current_url . split ( '<STR_LIT:?>' ) [ <NUM_LIT:0> ] . split ( '<STR_LIT:/>' ) [ <NUM_LIT:4> ] <EOL> url = current_url . split ( '<STR_LIT:?>' ) [ <NUM_LIT:1> ] . split ( '<STR_LIT:=>' ) [ <NUM_LIT:1> ] <EOL> clicked = self . request . cookies . get ( str ( uid + '<STR_LIT>' ) ) <EOL> if clicked != '<STR_LIT:True>' : <EOL> self . response . set_cookie ( str ( uid + '<STR_LIT>' ) , '<STR_LIT:True>' , max_age = <NUM_LIT> , path = '<STR_LIT:/>' ) <EOL> repodata_views = db . GqlQuery ( "<STR_LIT>" , u = uid ) . get ( ) <EOL> repodata_views . views_gh += <NUM_LIT:1> <EOL> repodata_views . put ( ) <EOL> self . redirect ( url ) </s>
