diff --git a/doc/api/pymongo/json_util.rst b/doc/api/pymongo/json_util.rst index fc48ecb23..89c4219c2 100644 --- a/doc/api/pymongo/json_util.rst +++ b/doc/api/pymongo/json_util.rst @@ -1,6 +1,7 @@ -:mod:`json_util` -- Tools for using Python's json module with MongoDB documents -=============================================================================== +:mod:`json_util` -- Tools for using Python's :mod:`json` module with MongoDB documents +====================================================================================== .. automodule:: pymongo.json_util :synopsis: Tools for using Python's json module with MongoDB documents :members: + :undoc-members: diff --git a/pymongo/json_util.py b/pymongo/json_util.py index 961e5c283..fd7051bab 100644 --- a/pymongo/json_util.py +++ b/pymongo/json_util.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""Tools for using the json (or simplejson) module with MongoDB documents. +"""Tools for using Python's :mod:`json` module with MongoDB documents. This module provides two methods: `object_hook` and `default`. These names are pretty terrible, but match the names used in Python's `json library @@ -22,10 +22,12 @@ encoding and decoding of MongoDB documents into `Mongo Extended JSON This lets you encode / decode MongoDB documents to JSON even when they use special PyMongo types. -Example usage (serialization): +Example usage (serialization):: + >>> json.dumps(..., default=json_util.default) -Example usage (deserialization): +Example usage (deserialization):: + >>> json.loads(..., object_hook=json_util.object_hook) Currently this only handles special encoding and decoding for ObjectId and diff --git a/setup.py b/setup.py index 05b5465ee..acb87dbf2 100755 --- a/setup.py +++ b/setup.py @@ -49,13 +49,19 @@ class GenerateDoc(Command): pass def run(self): - path = "doc/%s" % version + path = "doc/_build/%s" % version - shutil.rmtree("doc", ignore_errors=True) - os.makedirs(path) + # shutil.rmtree("doc/_build", ignore_errors=True) + try: + os.makedirs(path) + except: + pass if has_subprocess: - subprocess.call(["epydoc", "--config", "epydoc-config", "-o", path]) + subprocess.call(["sphinx-build", "-b", "html", "doc", path]) + print "" + print "Documentation generated:" + print " %s/index.html" % path else: print """ `setup.py doc` is not supported for this version of Python.