Ejemplo n.º 1
0
def new_user(**kw):
    user = User(
            parent=User.parent_key(),
            name = kw['account'],
            img_key = '',
            chatclass = random.randrange(0,4),
            account = kw['account'],
            passward = hash_passward(kw['account'],kw['passward']),
            fbuser = False,
        )
    user.put()
    return user.key.id()
Ejemplo n.º 2
0
def new_facebook_user(fb_cookie):
    graph = facebook.GraphAPI(fb_cookie["access_token"])
    profile = graph.get_object("me")
    user = User(
        parent=User.parent_key(),
        fbuser = True,
        fid = str(profile["id"]),
        name = profile["name"],
        img_key = '',
        profile_url = profile["link"],
        access_token = fb_cookie["access_token"]
    )
    user.put()
    return user