This repository has been archived by the owner on Mar 16, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
183 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
COVERAGE_MODULES = [ | ||
'app', | ||
'handlers', | ||
'models', | ||
] | ||
|
||
def all(): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env python | ||
import os | ||
import site | ||
|
||
ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) | ||
path = lambda *a: os.path.join(ROOT,*a) | ||
|
||
site.addsitedir(path('.')) | ||
site.addsitedir(path('vendor')) | ||
|
||
import redis as redis_ | ||
|
||
def run(): | ||
import settings | ||
from models import connection | ||
db = connection[settings.DATABASE_NAME] | ||
redis = redis_.client.Redis(settings.REDIS_HOST, | ||
settings.REDIS_PORT) | ||
|
||
for username in redis.smembers('allusernames'): | ||
key = 'access_tokens:%s' % username | ||
access_token = redis.get(key) | ||
if access_token: | ||
user = db.User.find_one({'username': username}) | ||
if not user: | ||
user = db.User() | ||
user['username'] = username | ||
user['access_token'] = access_token | ||
user.save() | ||
|
||
if __name__ == '__main__': | ||
run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
python bin/_run_tests.py --logging=error $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import datetime | ||
from mongolite import Connection, Document | ||
connection = Connection() | ||
|
||
@connection.register | ||
class User(Document): | ||
__collection__ = 'users' | ||
structure = { | ||
'username': unicode, | ||
'access_token': dict, | ||
'modify_date': datetime.datetime | ||
} | ||
|
||
default_values = {'modify_date':datetime.datetime.utcnow} | ||
|
||
def save(self, *args, **kwargs): | ||
if '_id' in self and kwargs.get('update_modify_date', True): | ||
self.modify_date = datetime.datetime.utcnow() | ||
super(User, self).save(*args, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.