def add_user(name,email): # if name is null, use the prefix of email as name if name == None : name = email.split('@')[0] # if email exists, then return user id. otherwise add new record and return user id query = None try : query = User.get(User.email == email) if query.u_name != name: query.u_name = name query.save() except: User.create(u_name=name,email = email) query = User.get(User.email == email) return query
def get_user_admin(email): query=User.get(User.email == email) user_admin = [] if query.admin_pro: projects = query.admin_pro.split(',') for pid in projects: if pid: pname = Project.get(Project.p_id == int(pid)).p_name user_admin.append({'p_id':str(pid),'p_name':pname}) return user_admin