Merge to Master from API_Dev

This commit is contained in:
Sagi Dayan 2015-05-12 11:38:29 +03:00
commit 7e2d8914a7
4 changed files with 29 additions and 23 deletions

View file

@ -7,11 +7,14 @@ import requests
import uuid
from flask import Flask, request, render_template, redirect, abort
# from User import User
from flask.ext.github import GitHub
from flask.ext.cors import CORS, cross_origin
from flask.ext.autodoc import Autodoc
# DB Models
from models.User import User
@ -124,20 +127,3 @@ def cookieMonster(uid):
response = app.make_response(redirect_to_home )
response.set_cookie('com.sehub.www',value=uid)
return response
class User(db.Model):
username = db.StringProperty(required=True)
name = db.StringProperty(required=True)
email = db.StringProperty(required=True)
isLecturer = db.BooleanProperty(required=True)
accsessToken = db.StringProperty(required=True)
seToken = db.StringProperty(required=True)
avatar_url = db.StringProperty(required=True)
isFirstLogin = db.BooleanProperty(default=True)
def to_JSON(self):
return json.dumps(self, default=lambda o: o.__dict__,
sort_keys=True, indent=4)

View file

@ -1,4 +0,0 @@
from google.appengine.ext import db

View file

@ -1 +0,0 @@
__author__ = 'sagi'

25
models/User.py Normal file
View file

@ -0,0 +1,25 @@
import json
__author__ = 'Aran'
from google.appengine.ext import db
class User(db.Model):
username = db.StringProperty(required=True)
name = db.StringProperty(required=True)
email = db.StringProperty(required=True)
isLecturer = db.BooleanProperty(required=True)
accsessToken = db.StringProperty(required=True)
seToken = db.StringProperty(required=True)
avatar_url = db.StringProperty(required=True)
isFirstLogin = db.BooleanProperty(default=True)
def to_JSON(self):
dick = {'username' : self.username,
'name' : self.name,
'email' : self.email,
'isLecturer' : self.isLecturer,
'seToken' : self.seToken,
'avatar_url' : self.avatar_url,
'isFirstLogin' : self.isFirstLogin,
}
return json.dumps(dick)