From ea2a2b6abdad44e73a09f6a742be25517af48629 Mon Sep 17 00:00:00 2001 From: Mike Dirolf Date: Fri, 5 Feb 2010 14:24:26 -0500 Subject: [PATCH] dochub links --- doc/mongo_extensions.py | 1 - gridfs/__init__.py | 4 ++++ pymongo/collection.py | 14 ++++++++++++++ pymongo/connection.py | 2 ++ pymongo/cursor.py | 6 ++++++ pymongo/database.py | 12 ++++++++++++ pymongo/dbref.py | 2 ++ pymongo/objectid.py | 2 ++ 8 files changed, 42 insertions(+), 1 deletion(-) diff --git a/doc/mongo_extensions.py b/doc/mongo_extensions.py index b292796e0..759ed7ca5 100644 --- a/doc/mongo_extensions.py +++ b/doc/mongo_extensions.py @@ -82,7 +82,6 @@ def process_mongodoc_nodes(app, doctree, fromdocname): new_para = nodes.paragraph() new_para += link node.replace(para, new_para) - break def setup(app): diff --git a/gridfs/__init__.py b/gridfs/__init__.py index 06351f251..c4f363b05 100644 --- a/gridfs/__init__.py +++ b/gridfs/__init__.py @@ -16,6 +16,8 @@ The :mod:`gridfs` package is an implementation of GridFS on top of :mod:`pymongo`, exposing a file-like interface. + +.. mongodoc:: gridfs """ from gridfs.grid_file import GridFile @@ -32,6 +34,8 @@ class GridFS(object): :Parameters: - `database`: database to use + + .. mongodoc:: gridfs """ if not isinstance(database, Database): raise TypeError("database must be an instance of Database") diff --git a/pymongo/collection.py b/pymongo/collection.py index 94c387a11..c0e95c6ca 100644 --- a/pymongo/collection.py +++ b/pymongo/collection.py @@ -49,6 +49,8 @@ class Collection(object): - `options`: dictionary of collection options. see :meth:`~pymongo.database.Database.create_collection` for details. + + .. mongodoc:: collections """ if not isinstance(name, basestring): raise TypeError("name must be an instance of basestring") @@ -169,6 +171,8 @@ class Collection(object): - `to_save`: the SON object to be saved - `manipulate` (optional): manipulate the SON object before saving it - `safe` (optional): check that the save succeeded? + + .. mongodoc:: insert """ if not isinstance(to_save, dict): raise TypeError("cannot save object of type %s" % type(to_save)) @@ -201,6 +205,8 @@ class Collection(object): .. versionchanged:: 1.1 Bulk insert works with any iterable + + .. mongodoc:: insert """ docs = doc_or_docs if isinstance(docs, dict): @@ -275,6 +281,8 @@ class Collection(object): .. _update modifiers: http://www.mongodb.org/display/DOCS/Updating .. _upsert: http://www.mongodb.org/display/DOCS/Updating#Updating-Upserts + + .. mongodoc:: update """ if not isinstance(spec, dict): raise TypeError("spec must be an instance of dict") @@ -328,6 +336,8 @@ class Collection(object): removed. .. versionadded:: 1.1 The `safe` parameter. + + .. mongodoc:: remove """ spec = spec_or_object_id if spec is None: @@ -511,6 +521,8 @@ class Collection(object): .. seealso:: :meth:`ensure_index` .. _compound index: http://www.mongodb.org/display/DOCS/Indexes#Indexes-CompoundKeysIndexes + + .. mongodoc:: indexes """ if not isinstance(key_or_list, (str, unicode, list)): raise TypeError("key_or_list must either be a single key " @@ -774,6 +786,8 @@ class Collection(object): .. versionadded:: 1.2 .. _map reduce command: http://www.mongodb.org/display/DOCS/MapReduce + + .. mongodoc:: mapreduce """ command = SON([("mapreduce", self.__name), ("map", map), ("reduce", reduce)]) diff --git a/pymongo/connection.py b/pymongo/connection.py index 0ac3bf58a..9a57f3cdd 100644 --- a/pymongo/connection.py +++ b/pymongo/connection.py @@ -132,6 +132,8 @@ class Connection(object): # TODO support auth for pooling parameters. .. versionadded:: 1.1 The `network_timeout` parameter. + + .. mongodoc:: connections """ if host is None: host = self.HOST diff --git a/pymongo/cursor.py b/pymongo/cursor.py index 1c923ae23..1408ea948 100644 --- a/pymongo/cursor.py +++ b/pymongo/cursor.py @@ -42,6 +42,8 @@ class Cursor(object): """Create a new cursor. Should not be called directly by application developers. + + .. mongodoc:: cursors """ self.__collection = collection self.__spec = spec @@ -166,6 +168,8 @@ class Cursor(object): :Parameters: - `limit`: the number of results to return + + .. mongodoc:: limit """ if not isinstance(limit, int): raise TypeError("limit must be an int") @@ -340,6 +344,8 @@ class Cursor(object): def explain(self): """Returns an explain plan record for this cursor. + + .. mongodoc:: explain """ c = self.clone() c.__explain = True diff --git a/pymongo/database.py b/pymongo/database.py index 4973ddca3..0e6af3109 100644 --- a/pymongo/database.py +++ b/pymongo/database.py @@ -50,6 +50,8 @@ class Database(object): - `connection`: a :class:`~pymongo.connection.Connection` instance - `name`: database name + + .. mongodoc:: databases """ if not isinstance(name, basestring): raise TypeError("name must be an instance of basestring") @@ -234,6 +236,8 @@ class Database(object): .. versionchanged:: 1.4+ `command` can be a string in addition to a full document. .. versionadded:: 1.4 + + .. mongodoc:: commands """ if isinstance(command, str): @@ -308,6 +312,8 @@ class Database(object): Returns one of (:data:`~pymongo.OFF`, :data:`~pymongo.SLOW_ONLY`, :data:`~pymongo.ALL`). + + .. mongodoc:: profiling """ result = self.command({"profile": -1}) @@ -323,6 +329,8 @@ class Database(object): :Parameters: - `level`: the profiling level to use + + .. mongodoc:: profiling """ if not isinstance(level, int) or level < 0 or level > 2: raise ValueError("level must be one of (OFF, SLOW_ONLY, ALL)") @@ -331,6 +339,8 @@ class Database(object): def profiling_info(self): """Returns a list containing current profiling information. + + .. mongodoc:: profiling """ return list(self["system.profile"].find()) @@ -463,6 +473,8 @@ class Database(object): :Parameters: - `name`: the name of the user to authenticate - `password`: the password of the user to authenticate + + .. mongodoc:: authenticate """ if not isinstance(name, basestring): raise TypeError("name must be an instance of basestring") diff --git a/pymongo/dbref.py b/pymongo/dbref.py index a4054488f..d6a526417 100644 --- a/pymongo/dbref.py +++ b/pymongo/dbref.py @@ -35,6 +35,8 @@ class DBRef(object): .. versionadded:: 1.1.1 The `database` parameter. + + .. mongodoc:: dbrefs """ if not isinstance(collection, basestring): raise TypeError("collection must be an instance of basestring") diff --git a/pymongo/objectid.py b/pymongo/objectid.py index 2ab9923ec..56630b16f 100644 --- a/pymongo/objectid.py +++ b/pymongo/objectid.py @@ -68,6 +68,8 @@ class ObjectId(object): hexadecimal digits). .. _ObjectId: http://www.mongodb.org/display/DOCS/Object+IDs + + .. mongodoc:: objectids """ if oid is None: self.__generate()