当前位置: 首页>>代码示例>>Python>>正文


Python User.get方法代码示例

本文整理汇总了Python中model.user.User.get方法的典型用法代码示例。如果您正苦于以下问题:Python User.get方法的具体用法?Python User.get怎么用?Python User.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在model.user.User的用法示例。


在下文中一共展示了User.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: user_get

# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import get [as 别名]
    def user_get(cls, args):
        uid = args.get('uid')[0]
        user = User.get(int(uid))
        user.p = 't'
        user.update()

        return user.get_json() 
开发者ID:tonghuashuai,项目名称:OnlySync,代码行数:9,代码来源:root.py

示例2: gets_followed

# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import get [as 别名]
 def gets_followed(cls, user_id, start=0, limit=10):
     query = {'from_id': user_id}
     rs = get_cursor(cls.table).find(query).sort('_id', -1)\
                               .skip(start).limit(limit)
     for r in rs:
         to_id = r.get('to_id')
         yield User.get(to_id)
开发者ID:Daniel7725,项目名称:diggit,代码行数:9,代码来源:friendship.py

示例3: _process_users

# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import get [as 别名]
    def _process_users(self, session, **kwargs):
        modified_voters = set()
        new_user = None
        if "new_voter" in kwargs and kwargs["new_voter"]:
            new_user = User(name=kwargs["new_voter"])
            new_user.put()

            user_by_session = UserBySession(user=new_user, session=session)
            user_by_session.put()

        voter_keys = []
        if "voter_key" in kwargs:
            voter_keys = [kwargs["voter_key"]]
            if isinstance(kwargs["voter_key"], list):
                voter_keys = voter_keys[0]

            if "voter_name" in kwargs and not isinstance(kwargs["voter_name"], list):
                kwargs["voter_name"] = [kwargs["voter_name"]]

            for i in range(len(voter_keys)):
                voter = User.get(voter_keys[i])
                voter.name = kwargs["voter_name"][i]
                voter.put()
                modified_voters.add(voter)

        return (new_user, modified_voters)
开发者ID:mtambos,项目名称:brainstormcracy,代码行数:28,代码来源:brainstorming_session.py

示例4: post

# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import get [as 别名]
    def post(self):
        # TODO: hey, add user?!!!
        user = self.get_argument("user", "wooparadog")
        user = User.get(name=user)
        repo_name = self.get_argument("name", None)
        repo_desc = self.get_argument("desc", None)

        re_dir = create_new_repo(user=user, name=repo_name, desc=repo_desc)
        self.redirect(re_dir.link)
开发者ID:wooparadog,项目名称:woocode,代码行数:11,代码来源:index.py

示例5: get

# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import get [as 别名]
    def get(self):
        user_id = self.get_cookie("userid")
        logging.info(user_id)
        if user_id is not None:
            user = User.get(user_id)
            if user is not None:
                self.user = user.name

        self.render_index()
开发者ID:M4573R,项目名称:udacity-1,代码行数:11,代码来源:home.py

示例6: get

# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import get [as 别名]
	def get(self, user_key):
		account = User.get(user_key)
		if not account:
			self.redirect('/')
		if account.confirmed:
			logging.error('user %s is already confirmed' % account.key().name())
		account.confirmed = True
		account.put()
		self.redirect('/dashboard')
开发者ID:jamslevy,项目名称:passtiche,代码行数:11,代码来源:account.py

示例7: get

# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import get [as 别名]
    def get(self, uid):
        user = User.get(uid)
        if not user:
            self.redirect('/404')
            return

        # TODO liked
        page = self.get_argument('page', '1')
        page = int(page) if page.isdigit() else 1

        self.render('user.html', user=user, page=page)
开发者ID:Daniel7725,项目名称:diggit,代码行数:13,代码来源:user.py

示例8: get_participants

# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import get [as 别名]
    def get_participants(self):
        rows = db.query('SELECT user_id FROM lunch_participants '
                     'WHERE lunch_id=%s', int(self.id))
        if not rows:
            return None

        participants = []
        for row in rows:
            participants.append(User.get(row['user_id']))

        return participants
开发者ID:siavashg,项目名称:lunchspire,代码行数:13,代码来源:lunch.py

示例9: test

# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import get [as 别名]
def test():
    # Bookmark.create(
    #     user_mail="[email protected]",
    #     url="http://www.xiachufang.com/",
    #     title="title test",
    #     article="article test",
    #     full_text="full_text test"
    # )
    from model.user import User
    u = User.get("[email protected]")
    print Bookmark.get('[email protected]:http://www.baidu.com')
    print Bookmark.search_in_user(u, '百度')
    print "*****************"
    for link in Bookmark.search_in_site("百度", limit=5):
        print link['_id']
开发者ID:AllSundays,项目名称:yummy,代码行数:17,代码来源:bookmark.py

示例10: _on_auth

# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import get [as 别名]
    def _on_auth(self, user):
        if not user:
            raise tornado.web.HTTPError(500, 'Twitter auth failed')

        instance = User.get(user['id'])
        if not instance:
            access_key = user['access_token']['key']
            access_secret = user['access_token']['secret']
            instance = User.create(user['id'], xhtml_escape(user['name']),
                        user['profile_image_url_https'], access_key,
                        access_secret, user['username'])
        if not instance:
            raise RuntimeError('Uhm.. yeah.. about that..')

        self.set_login(instance)
        self.redirect('/')
开发者ID:siavashg,项目名称:lunchspire,代码行数:18,代码来源:authhandler.py

示例11: load_user

# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import get [as 别名]
def load_user(request, form_token=None):
    token = request.headers.get('Authorization')
    if token is None and form_token is None:
        token = request.args.get('token')
    elif form_token:
        token = form_token

    if token is not None:
        username, password = token.split(":")  # naive token
        user_entry = User.get(username, password)
        if (user_entry is not None):
            user = User(user_entry.email, user_entry.pw)
            if (user.password == password):
                return user
            else:
                raise Exception('Login incorrect.')
    return None
开发者ID:astromitts,项目名称:astrolist,代码行数:19,代码来源:user.py

示例12: reload_user

# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import get [as 别名]
def reload_user(user_id):
    return User.get(user_id)
开发者ID:astromitts,项目名称:astrolist,代码行数:4,代码来源:user.py

示例13: author

# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import get [as 别名]
 def author(self):
     return self.author_id and User.get(self.author_id)
开发者ID:suncarl,项目名称:diggit,代码行数:4,代码来源:photo.py

示例14: get

# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import get [as 别名]
 def get(self, username):
     user = User.get(name=username)
     if user:
         self.render("/app/account/index.html", user=user)
开发者ID:wooparadog,项目名称:woocode,代码行数:6,代码来源:account.py

示例15: creators

# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import get [as 别名]
 def creators(self):
     return self.from_ids and [User.get(fid) for fid in self.from_ids]
开发者ID:Daniel7725,项目名称:diggit,代码行数:4,代码来源:message.py


注:本文中的model.user.User.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。