本文整理汇总了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()
示例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)
示例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)
示例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)
示例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()
示例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')
示例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)
示例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
示例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']
示例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('/')
示例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
示例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)
示例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)
示例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)
示例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]