Skip to content

Commit

Permalink
add more documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelnicolay committed Nov 13, 2012
1 parent 35e3d2a commit d57fdbb
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 70 deletions.
17 changes: 12 additions & 5 deletions docs/source/api/collection.rst
Original file line number Diff line number Diff line change
@@ -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

11 changes: 11 additions & 0 deletions docs/source/api/errors.rst
Original file line number Diff line number Diff line change
@@ -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
8 changes: 2 additions & 6 deletions docs/source/api/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
replica_set
11 changes: 11 additions & 0 deletions docs/source/api/orm.rst
Original file line number Diff line number Diff line change
@@ -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
55 changes: 0 additions & 55 deletions docs/source/intalattion.rst

This file was deleted.

16 changes: 12 additions & 4 deletions mongotor/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,34 @@


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):
pass


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
Expand Down

0 comments on commit d57fdbb

Please sign in to comment.