Created
April 16, 2014 13:50
-
-
Save bikeath1337/10878664 to your computer and use it in GitHub Desktop.
Generate a nice_key with dborutils.key_service
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
from dborutils.mongo_client import NoodleMongoClient | |
from dborutils.key_service import NoodleKeyService | |
# Requires dborutils v0.2.2 | |
collection_spec = "localhost:graduate:production" | |
namespace_client = NoodleMongoClient.create_from_mongo_spec(collection_spec) | |
# this returns the production collection from your client spec. | |
collection = namespace_client.collection() | |
# this needs to be set by the category, of course | |
prefix = 'gr' | |
nice_key = NoodleKeyService().generate_nice_key(namespace_collection=collection, prefix=prefix) | |
print nice_key |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment