Skip to content

Commit

Permalink
weibo login and user last_login OK
Browse files Browse the repository at this point in the history
  • Loading branch information
minghk committed May 8, 2012
1 parent 8e9aa8e commit da0d853
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion archive_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def post(self):
"total_games": user.total_games,
"won_games": user.won_games,
"max_reward": user.max_reward,
"last_login": user.last_login.strftime("%Y-%m-%d %H:%M:%S"),
"last_login": datetime.fromtimestamp(user.last_login).strftime("%Y-%m-%d %H:%M:%S"),
"signature": user.signature or "This guy is too lazy to leave a signature"
}
self.write(json.dumps(message))
Expand Down
6 changes: 3 additions & 3 deletions login_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def post(self):
else:
message = {'status':'success'}
self.session['user_id'] = user.id
user.last_login = datetime.now()
user.last_login = int(time.time())
self.set_header('Access-Control-Allow-Origin', '*')
self.write(json.dumps(message))

Expand All @@ -44,7 +44,7 @@ def post(self):
else:
message = {'status':'success', 'username':user.username, 'password':password}
self.session['user_id'] = user.id
user.last_login = datetime.now()
user.last_login = int(time.time())

self.set_header('Access-Control-Allow-Origin', '*')
self.write(json.dumps(message))
Expand Down Expand Up @@ -83,7 +83,7 @@ def get_user_info(self,code):
accountID=uid)
if not user:
user_info = client.get.users__show(uid=uid)
user = User.new(username="%s_%s" % (User.USER_TYPE_SINA_WEIBO,accountID),\
user = User.new(username="%s_%s" % (User.USER_TYPE_SINA_WEIBO,uid),\
accountType=User.USER_TYPE_SINA_WEIBO,accountID=uid)
user.screen_name = user_info.screen_name
user.gender = user_info.gender
Expand Down
8 changes: 4 additions & 4 deletions thread_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ def in_ioloop(fn):

@wraps(fn)
def res(*args, **kwargs):
if hasattr(thread_locals,"ioloop"):
if thread_locals.ioloop:
fn(*args, **kwargs)
return
if hasattr(thread_locals,"ioloop"):
if thread_locals.ioloop:
fn(*args, **kwargs)
return

get_ioloop().add_callback(partial(fn, *args, **kwargs))

Expand Down

0 comments on commit da0d853

Please sign in to comment.