Beispiel #1
0
def createTag(environ, start_response):
    sql_host = util.fapwsGetSqlHost(environ)
    d = db.DB(sql_host)
    #print(environ)
    fin = environ.get("wsgi.input", None)
    params = {}
    pra = cgi.parse_header(fin.read())
    #print pra
    pra = cgi.parse_multipart(fin, params)
    #print pra
    #username = util.fapwsGetParam(environ,"username")
    #password = util.fapwsGetParam(environ,"password")
    #latitude = util.fapwsGetParam(environ,"latitude")
    #longitude = util.fapwsGetParam(environ,"longitude")
    #orientation = util.fapwsGetParam(environ,"orientation")
    #strio = None
    #strio = environ.get("wsgi.input",None)
    fault = util.getFaultTemplate(True)
    res = json.dumps(fault)
    #uploadedFile = None
    #errors = environ.get("wsgi.errors")
    #print(errors.read())
    #print(username)
    #print(password)
    #print(latitude)
    #print(longitude)
    #print(orientation)
    #print(strio)
    #print(uploadedFile)
    #if(strio): uploadedFile = util.UploadedFile(strio.read())
    #util.fapws200OK(start_response,ctypes.TEXT_JAVASCRIPT)
    #if(util.checkNulls(fault,username,password,latitude,longitude,orientation,uploadedFile,strio)): res = json.dumps(fault)
    #else: res = services.PublishService().json(d,username,password,latitude,longitude,orientation,uploadedFile)
    return [res]
Beispiel #2
0
def createTag(environ,start_response):
	sql_host = util.fapwsGetSqlHost(environ)
	d = db.DB(sql_host)
	#print(environ)
	fin = environ.get("wsgi.input",None)
	params = {}
	pra = cgi.parse_header(fin.read())
	#print pra
	pra = cgi.parse_multipart(fin,params)
	#print pra
	#username = util.fapwsGetParam(environ,"username")
	#password = util.fapwsGetParam(environ,"password")
	#latitude = util.fapwsGetParam(environ,"latitude")
	#longitude = util.fapwsGetParam(environ,"longitude")
	#orientation = util.fapwsGetParam(environ,"orientation")
	#strio = None
	#strio = environ.get("wsgi.input",None)
	fault = util.getFaultTemplate(True)
	res = json.dumps(fault)
	#uploadedFile = None
	#errors = environ.get("wsgi.errors")
	#print(errors.read())
	#print(username)
	#print(password)
	#print(latitude)
	#print(longitude)
	#print(orientation)
	#print(strio)
	#print(uploadedFile)
	#if(strio): uploadedFile = util.UploadedFile(strio.read())
	#util.fapws200OK(start_response,ctypes.TEXT_JAVASCRIPT)
	#if(util.checkNulls(fault,username,password,latitude,longitude,orientation,uploadedFile,strio)): res = json.dumps(fault)
	#else: res = services.PublishService().json(d,username,password,latitude,longitude,orientation,uploadedFile)
	return [res]
Beispiel #3
0
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]
Beispiel #4
0
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]
Beispiel #5
0
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]
Beispiel #6
0
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]
Beispiel #7
0
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]
Beispiel #8
0
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]
Beispiel #9
0
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]
Beispiel #10
0
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]
Beispiel #11
0
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]
Beispiel #12
0
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]
Beispiel #13
0
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]
Beispiel #14
0
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]
Beispiel #15
0
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]
Beispiel #16
0
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]
Beispiel #17
0
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]
Beispiel #18
0
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]