def rating(environ,start_response): sql_host = util.fapwsGetSqlHost(environ) d = db.DB(sql_host) offset = util.fapwsGetParam(environ,"offset",0) limit = util.fapwsGetParam(environ,"limit",25) fault = util.getFaultTemplate(True) util.fapws200OK(start_response,ctypes.TEXT_JAVASCRIPT) if(util.checkNulls(fault,offset,limit)): res = json.dumps(fault) else: res = services.RatingService().json(d,offset,limit) return [res]
def rating(environ, start_response): sql_host = util.fapwsGetSqlHost(environ) d = db.DB(sql_host) offset = util.fapwsGetParam(environ, "offset", 0) limit = util.fapwsGetParam(environ, "limit", 25) fault = util.getFaultTemplate(True) util.fapws200OK(start_response, ctypes.TEXT_JAVASCRIPT) if (util.checkNulls(fault, offset, limit)): res = json.dumps(fault) else: res = services.RatingService().json(d, offset, limit) return [res]
def rateTag(environ,start_response): sql_host = util.fapwsGetSqlHost(environ) d = db.DB(sql_host) tagId = util.fapwsGetParam(environ,"tagId") rating = util.fapwsGetParam(environ,"rating") fault = util.getFaultTemplate(True) util.fapws200OK(start_response,ctypes.TEXT_JAVASCRIPT) if(util.checkNulls(fault,tagId,rating)): res = json.dumps(fault) else: res = services.RateTagService().json(d,tagId,rating) return [res]
def rateTag(environ, start_response): sql_host = util.fapwsGetSqlHost(environ) d = db.DB(sql_host) tagId = util.fapwsGetParam(environ, "tagId") rating = util.fapwsGetParam(environ, "rating") fault = util.getFaultTemplate(True) util.fapws200OK(start_response, ctypes.TEXT_JAVASCRIPT) if (util.checkNulls(fault, tagId, rating)): res = json.dumps(fault) else: res = services.RateTagService().json(d, tagId, rating) return [res]
def register(environ, start_response): sql_host = util.fapwsGetSqlHost(environ) d = db.DB(sql_host) username = util.fapwsGetParam(environ,"username") email = util.fapwsGetParam(environ,"email") password = util.fapwsGetParam(environ,"password") fault = util.getFaultTemplate(True) util.fapws200OK(start_response,ctypes.TEXT_JAVASCRIPT) if(util.checkNulls(fault,username,email,password)): res = json.dumps(fault) else: res = services.RegisterService().json(d,email,username,password) return [res]
def deleteTag(environ,start_response): sql_host = util.fapwsGetSqlHost(environ) d = db.DB(sql_host) username = util.fapwsGetParam(environ,"username") password = util.fapwsGetParam(environ,"password") tagId = util.fapwsGetParam(environ,"tagId") fault = util.getFaultTemplate(True) util.fapws200OK(start_response,ctypes.TEXT_JAVASCRIPT) if(util.checkNulls(fault,username,password,tagId)): res = json.dumps(fault) else: res = services.DeleteTagService().json(d,tagId,username,password) return [res]
def login(environ, start_response): """ Login wsgi handler for fapws. """ sql_host = util.fapwsGetSqlHost(environ) d = db.DB(sql_host) username = util.fapwsGetParam(environ,"username") password = util.fapwsGetParam(environ,"password") fault = util.getFaultTemplate(True) util.fapws200OK(start_response,ctypes.TEXT_JAVASCRIPT) if(util.checkNulls(fault,username,password)): res = json.dumps(fault) else: res = services.LoginService().json(d,username,password) return [res]
def login(environ, start_response): """ Login wsgi handler for fapws. """ sql_host = util.fapwsGetSqlHost(environ) d = db.DB(sql_host) username = util.fapwsGetParam(environ, "username") password = util.fapwsGetParam(environ, "password") fault = util.getFaultTemplate(True) util.fapws200OK(start_response, ctypes.TEXT_JAVASCRIPT) if (util.checkNulls(fault, username, password)): res = json.dumps(fault) else: res = services.LoginService().json(d, username, password) return [res]
def register(environ, start_response): sql_host = util.fapwsGetSqlHost(environ) d = db.DB(sql_host) username = util.fapwsGetParam(environ, "username") email = util.fapwsGetParam(environ, "email") password = util.fapwsGetParam(environ, "password") fault = util.getFaultTemplate(True) util.fapws200OK(start_response, ctypes.TEXT_JAVASCRIPT) if (util.checkNulls(fault, username, email, password)): res = json.dumps(fault) else: res = services.RegisterService().json(d, email, username, password) return [res]
def deleteTag(environ, start_response): sql_host = util.fapwsGetSqlHost(environ) d = db.DB(sql_host) username = util.fapwsGetParam(environ, "username") password = util.fapwsGetParam(environ, "password") tagId = util.fapwsGetParam(environ, "tagId") fault = util.getFaultTemplate(True) util.fapws200OK(start_response, ctypes.TEXT_JAVASCRIPT) if (util.checkNulls(fault, username, password, tagId)): res = json.dumps(fault) else: res = services.DeleteTagService().json(d, tagId, username, password) return [res]
def listTagsByUser(environ,start_response): sql_host = util.fapwsGetSqlHost(environ) d = db.DB(sql_host) username = util.fapwsGetParam(environ,"username") offset = util.fapwsGetParam(environ,"offset",0) limit = util.fapwsGetParam(environ,"limit",25) if(not offset): offset = 0 if(not limit): limit = 25 if(limit and int(limit) > 25 or int(limit) < 5): limit = 25 fault = util.getFaultTemplate(True) util.fapws200OK(start_response,ctypes.TEXT_JAVASCRIPT) if(util.checkNulls(fault,username,offset,limit)): res = json.dumps(fault) else: res = services.ListTagsByUserService().json(d,username,offset,limit) return [res]
def listTagsByUser(environ, start_response): sql_host = util.fapwsGetSqlHost(environ) d = db.DB(sql_host) username = util.fapwsGetParam(environ, "username") offset = util.fapwsGetParam(environ, "offset", 0) limit = util.fapwsGetParam(environ, "limit", 25) if (not offset): offset = 0 if (not limit): limit = 25 if (limit and int(limit) > 25 or int(limit) < 5): limit = 25 fault = util.getFaultTemplate(True) util.fapws200OK(start_response, ctypes.TEXT_JAVASCRIPT) if (util.checkNulls(fault, username, offset, limit)): res = json.dumps(fault) else: res = services.ListTagsByUserService().json(d, username, offset, limit) return [res]
def getProfileInfo(environ,start_response): sql_host = util.fapwsGetSqlHost(environ) d = db.DB(sql_host) username = util.fapwsGetParam(environ,"username") fault = util.getFaultTemplate(True) util.fapws200OK(start_response,ctypes.TEXT_JAVASCRIPT) if(util.checkNulls(fault,username)): res = json.dumps(fault) else: res = services.GetProfileInfoService().json(d,username) return [res]
def getProfileInfo(environ, start_response): sql_host = util.fapwsGetSqlHost(environ) d = db.DB(sql_host) username = util.fapwsGetParam(environ, "username") fault = util.getFaultTemplate(True) util.fapws200OK(start_response, ctypes.TEXT_JAVASCRIPT) if (util.checkNulls(fault, username)): res = json.dumps(fault) else: res = services.GetProfileInfoService().json(d, username) return [res]
def facebook(environ,start_response): sql_host = util.fapwsGetSqlHost(environ) d = db.DB(sql_host) imageName = util.fapwsGetParam(environ,"imageName") res = services.FacebookShareService().html(d,imageName) return [res]
def facebook(environ, start_response): sql_host = util.fapwsGetSqlHost(environ) d = db.DB(sql_host) imageName = util.fapwsGetParam(environ, "imageName") res = services.FacebookShareService().html(d, imageName) return [res]