<s> import os <EOL> import re <EOL> import time <EOL> import datetime <EOL> import hashlib <EOL> import string <EOL> import random <EOL> import config <EOL> from google . appengine . ext import webapp <EOL> from google . appengine . api import memcache <EOL> from google . appengine . ext import db <EOL> from google . appengine . ext . webapp import util <EOL> from google . appengine . ext . webapp import template <EOL> from v2ex . babel import Member <EOL> from v2ex . babel import Counter <EOL> from v2ex . babel import Section <EOL> from v2ex . babel import Node <EOL> from v2ex . babel import Topic <EOL> from v2ex . babel import Reply <EOL> from v2ex . babel import Note <EOL> from v2ex . babel import SYSTEM_VERSION <EOL> from v2ex . babel . security import * <EOL> from v2ex . babel . ua import * <EOL> from v2ex . babel . da import * <EOL> from v2ex . babel . l10n import * <EOL> from v2ex . babel . ext . cookies import Cookies <EOL> template . register_template_library ( '<STR_LIT>' ) <EOL> class SSOV0Handler ( webapp . RequestHandler ) : <EOL> def get ( self ) : <EOL> site = GetSite ( ) <EOL> self . response . headers [ '<STR_LIT>' ] = '<STR_LIT:application/json>' <EOL> u = self . request . get ( '<STR_LIT:u>' ) . strip ( ) . lower ( ) <EOL> p = self . request . get ( '<STR_LIT:p>' ) . strip ( ) <EOL> failed = '<STR_LIT>' <EOL> if ( len ( u ) > <NUM_LIT:0> ) and ( len ( p ) > <NUM_LIT:0> ) : <EOL> q = db . GqlQuery ( "<STR_LIT>" , u , p ) <EOL> if q . count ( ) > <NUM_LIT:0> : <EOL> member = q [ <NUM_LIT:0> ] <EOL> if member . avatar_mini_url : <EOL> if ( member . avatar_mini_url [ <NUM_LIT:0> : <NUM_LIT:1> ] == '<STR_LIT:/>' ) : <EOL> member . avatar_mini_url = '<STR_LIT>' + site . domain + member . avatar_mini_url <EOL> member . avatar_normal_url = '<STR_LIT>' + site . domain + member . avatar_normal_url <EOL> member . avatar_large_url = '<STR_LIT>' + site . domain + member . avatar_large_url <EOL> else : <EOL> member . avatar_mini_url = '<STR_LIT>' + site . domain + '<STR_LIT>' <EOL> member . avatar_normal_url = '<STR_LIT>' + site . domain + '<STR_LIT>' <EOL> member . avatar_large_url = '<STR_LIT>' + site . domain + '<STR_LIT>' <EOL> self . response . out . write ( '<STR_LIT>' + str ( member . num ) + '<STR_LIT>' + member . username + '<STR_LIT>' + member . username_lower + '<STR_LIT>' + member . email + '<STR_LIT>' + member . avatar_mini_url + '<STR_LIT>' + member . avatar_normal_url + '<STR_LIT>' + member . avatar_large_url + '<STR_LIT>' + str ( time . mktime ( member . created . timetuple ( ) ) ) + '<STR_LIT>' + str ( time . mktime ( member . last_modified . timetuple ( ) ) ) + '<STR_LIT:}>' ) <EOL> else : <EOL> self . response . out . write ( failed ) <EOL> else : <EOL> self . response . out . write ( failed ) <EOL> class SSOX0Handler ( webapp . RequestHandler ) : <EOL> def get ( self ) : <EOL> site = GetSite ( ) <EOL> self . response . headers [ '<STR_LIT>' ] = '<STR_LIT:application/json>' <EOL> x = self . request . get ( '<STR_LIT:x>' ) . strip ( ) <EOL> n = self . request . get ( '<STR_LIT:n>' ) . strip ( ) . lower ( ) <EOL> failed = '<STR_LIT>' <EOL> if x == config . ssox : <EOL> q = db . GqlQuery ( "<STR_LIT>" , n ) <EOL> if q . count ( ) > <NUM_LIT:0> : <EOL> member = q [ <NUM_LIT:0> ] <EOL> if member . avatar_mini_url : <EOL> if ( member . avatar_mini_url [ <NUM_LIT:0> : <NUM_LIT:1> ] == '<STR_LIT:/>' ) : <EOL> member . avatar_mini_url = '<STR_LIT>' + site . domain + member . avatar_mini_url <EOL> member . avatar_normal_url = '<STR_LIT>' + site . domain + member . avatar_normal_url <EOL> member . avatar_large_url = '<STR_LIT>' + site . domain + member . avatar_large_url <EOL> else : <EOL> member . avatar_mini_url = '<STR_LIT>' + site . domain + '<STR_LIT>' <EOL> member . avatar_normal_url = '<STR_LIT>' + site . domain + '<STR_LIT>' <EOL> member . avatar_large_url = '<STR_LIT>' + site . domain + '<STR_LIT>' <EOL> self . response . out . write ( '<STR_LIT>' + str ( member . num ) + '<STR_LIT>' + member . username + '<STR_LIT>' + member . username_lower + '<STR_LIT>' + member . email + '<STR_LIT>' + member . password + '<STR_LIT>' + member . avatar_mini_url + '<STR_LIT>' + member . avatar_normal_url + '<STR_LIT>' + member . avatar_large_url + '<STR_LIT>' + str ( time . mktime ( member . created . timetuple ( ) ) ) + '<STR_LIT>' + str ( time . mktime ( member . last_modified . timetuple ( ) ) ) + '<STR_LIT:}>' ) <EOL> else : <EOL> self . response . out . write ( failed ) <EOL> else : <EOL> self . response . out . write ( failed ) <EOL> def main ( ) : <EOL> application = webapp . WSGIApplication ( [ <EOL> ( '<STR_LIT>' , SSOV0Handler ) , <EOL> ( '<STR_LIT>' , SSOX0Handler ) <EOL> ] , <EOL> debug = True ) <EOL> util . run_wsgi_app ( application ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> main ( ) </s>
