Skip to content

Instantly share code, notes, and snippets.

@imsickofmaps
Created September 17, 2013 13:01
Show Gist options
  • Select an option

  • Save imsickofmaps/6594008 to your computer and use it in GitHub Desktop.

Select an option

Save imsickofmaps/6594008 to your computer and use it in GitHub Desktop.
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