Created
September 17, 2013 13:01
-
-
Save imsickofmaps/6594008 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| def get_account(email, password): | |
| """ trys to find the newest cart a user created """ | |
| query = g.rc.add(core.config['RIAK_BUCKET_PREFIX'] + 'users') | |
| # This gets just keys | |
| query.map(""" | |
| function(v, meta, arg) { | |
| var data = JSON.parse(v.values[0].data); | |
| if(data[username] == arg[username] && data[password] == arg[password]){ | |
| return [v.key]; | |
| } else { | |
| return []; | |
| } | |
| }""", {"arg": {"username": email, "password": password}}) | |
| result = query.run() | |
| if result is None: | |
| return False | |
| else: | |
| return result[0] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment