diff --git a/docs/source/api/collection.rst b/docs/source/api/collection.rst index eae091d..6f41e92 100644 --- a/docs/source/api/collection.rst +++ b/docs/source/api/collection.rst @@ -1,11 +1,18 @@ -:mod:`collection` -- Map a mongo collection into a python class +:mod:`collection` -- A mongo collection ============================================ -.. automodule:: mongotor.orm.collection - :synopsis: map a mongo collection to a python class +.. automodule:: mongotor.client + :synopsis: a mongo collection - .. autoclass:: mongotor.orm.collection.Collection + .. autoclass:: mongotor.client.Client - .. automethod:: save + .. automethod:: insert .. automethod:: remove .. automethod:: update + .. automethod:: find_one + .. automethod:: find + .. automethod:: count + .. automethod:: distinct + .. automethod:: aggregate + .. automethod:: group + diff --git a/docs/source/api/errors.rst b/docs/source/api/errors.rst new file mode 100644 index 0000000..b4bd4c2 --- /dev/null +++ b/docs/source/api/errors.rst @@ -0,0 +1,11 @@ +:mod:`errors` -- Mongotor errors +============================================ + +.. automodule:: mongotor.errors + :synopsis: Mongotor errors + + .. autoclass:: mongotor.errors.Error + .. autoclass:: mongotor.errors.InterfaceError + .. autoclass:: mongotor.errors.TooManyConnections + .. autoclass:: mongotor.errors.InvalidOperationError + .. autoclass:: mongotor.errors.IntegrityError \ No newline at end of file diff --git a/docs/source/api/index.rst b/docs/source/api/index.rst index 485e638..ab3a137 100644 --- a/docs/source/api/index.rst +++ b/docs/source/api/index.rst @@ -17,12 +17,8 @@ Sub-modules: connection database collection - cursor + orm errors - master_slave_connection message pool - replica_set_connection - son_manipulator - cursor_manager - uri_parser \ No newline at end of file + replica_set diff --git a/docs/source/api/orm.rst b/docs/source/api/orm.rst new file mode 100644 index 0000000..43bf28d --- /dev/null +++ b/docs/source/api/orm.rst @@ -0,0 +1,11 @@ +:mod:`orm` -- Map a mongo collection into a python class +============================================ + +.. automodule:: mongotor.orm.collection + :synopsis: map a mongo collection to a python class + + .. autoclass:: mongotor.orm.collection.Collection + + .. automethod:: save + .. automethod:: remove + .. automethod:: update diff --git a/docs/source/intalattion.rst b/docs/source/intalattion.rst deleted file mode 100644 index 0b2ea45..0000000 --- a/docs/source/intalattion.rst +++ /dev/null @@ -1,55 +0,0 @@ -Installation -============ - - - -Supported Installation Methods -------------------------------- - -MongoTor supports installation using standard Python "distutils" or -"setuptools" methodologies. An overview of potential setups is as follows: - -Install via easy_install or pip -------------------------------- - -When ``easy_install`` or ``pip`` is available, the distribution can be -downloaded from Pypi and installed in one step:: - - easy_install mongotor - -Or with pip:: - - pip install mongotor - -This command will download the latest version of MongoTor from the `Python -Cheese Shop `_ and install it to your system. - -Installing using setup.py ----------------------------------- - -Otherwise, you can install from the distribution using the ``setup.py`` script:: - - python setup.py install - -Checking the Installed MongoTor Version ---------------------------------------------- - -The version of MongoTor installed can be checked from your -Python prompt like this: - -.. sourcecode:: python - - >>> import mongotor - >>> mongotor.version # doctest: +SKIP - -Requirements ------------- - -The following three python libraries are required. - - * `pymongo `_ version 1.9+ for bson library - * `tornado `_ - -.. note:: - The above requirements are automatically managed when installed using - any of the supported installation methods \ No newline at end of file diff --git a/mongotor/errors.py b/mongotor/errors.py index ccf48bb..7d61ead 100644 --- a/mongotor/errors.py +++ b/mongotor/errors.py @@ -17,19 +17,24 @@ class Error(StandardError): - pass + """Base class for all mongotor exceptions. + + """ class InterfaceError(Error): - pass + """Raised when a connection to the database cannot be made or is lost. + """ class TooManyConnections(InterfaceError): - pass + """Raised when a pool is busy. + """ class InvalidOperationError(Error): - pass + """Raised when a client attempts to perform an invalid operation. + """ class DatabaseError(Error): @@ -37,6 +42,9 @@ class DatabaseError(Error): class IntegrityError(DatabaseError): + """Raised when a safe insert or update fails due to a duplicate key error. + + """ def __init__(self, msg, code=None): self.code = code self.msg = msg