From 5715a74388ab86f7aba4692e8acdbc83bf200b22 Mon Sep 17 00:00:00 2001 From: Federico Di Gregorio Date: Mon, 17 Oct 2005 06:17:34 +0000 Subject: [PATCH] Applied patches to fix docstrings. --- ChangeLog | 6 ++++++ NEWS | 8 ++++++++ psycopg/connection_type.c | 9 +++++---- psycopg/psycopgmodule.c | 23 ++++++++++++++++++++++- 4 files changed, 41 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index c8e154ef..3ec53608 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-10-17 Federico Di Gregorio + + * psycopg/connection_type.c: fixed docstring for .cursor(). + + * psycopg/psycopgmodule.c: added useful docstring for .connect(). + 2005-10-08 Federico Di Gregorio * psycopg/connection_type.c: isolation level upper bound set to 2. diff --git a/NEWS b/NEWS index 1b2e8630..c717965d 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,14 @@ What's new in psycopg 2.0 rc 1 * Fixed all known bugs. +* The initial isolation level is now read from the server and + .set_isolation_level() now takes values defined in psycopg2.extensions. + +* .callproc() implemented as a SELECT of the given procedure. + +* Better docstrings for a few functions/methods. + + What's new in psycopg 2.0 beta 4 -------------------------------- diff --git a/psycopg/connection_type.c b/psycopg/connection_type.c index 8b185e60..7a32b8ba 100644 --- a/psycopg/connection_type.c +++ b/psycopg/connection_type.c @@ -37,10 +37,11 @@ /* cursor method - allocate a new cursor */ #define psyco_conn_cursor_doc \ -"cursor(factory=psycopg.cursor) -> new cursor\n\n" \ -"Return a new cursor. The 'factory' argument can be used to create\n" \ -"non-standard cursors by passing a class different from the default.\n" \ -"Note that the new class *should* be a sub-class of psycopg.cursor." +"cursor(cursor_factory=psycopg.cursor) -> new cursor\n\n" \ +"Return a new cursor. The 'cursor_factory' argument can be used to\n" \ +"create non-standard cursors by passing a class different from the\n" \ +"default. Note that the new class *should* be a sub-class of\n" \ +"'psycopg2.cursor'.\n" static PyObject * psyco_conn_cursor(connectionObject *self, PyObject *args, PyObject *keywds) diff --git a/psycopg/psycopgmodule.c b/psycopg/psycopgmodule.c index dcff7bc5..5702d1de 100644 --- a/psycopg/psycopgmodule.c +++ b/psycopg/psycopgmodule.c @@ -59,7 +59,27 @@ PyObject *psycoEncodings = NULL; PyObject *decimalType = NULL; /** connect module-level function **/ -#define psyco_connect_doc "connect(dsn, ...) -> new connection object" +#define psyco_connect_doc \ +"connect(dsn, ...) -> new connection object\n\n" \ +"This function supports two different but equivalent sets of arguments.\n" \ +"A single data source name or 'dsn' string can be used to specify the\n" \ +"connection parameters, as follows:\n\n" \ +" psycopg2.connect(\"dbname=xxx user=xxx ...\")\n\n" \ +"If 'dsn' is not provided it is possible to pass the parameters as\n" \ +"keyword arguments; e.g.,\n\n" \ +" psycopg2.connect(database='xxx', user='xxx', ...)\n\n" \ +"The full list of available parameters is:\n\n" \ +" dbname -- database name (only in 'dsn')\n" \ +" database -- database name (only as keyword argument)\n" \ +" host -- host address (defaults to UNIX socket if not provided)\n" \ +" port -- port number (defaults to 5432 if not provided)\n" \ +" user -- user name used to authenticate\n" \ +" password -- password used to authenticate\n" \ +" sslmode -- SSL mode (see PostgreSQL documentation)\n\n" \ +"If the 'connection_factory' keyword argument is not provided this\n" \ +"function always return an instance of the 'psycopg2.connection' class.\n" \ +"Else the given sub-class of 'psycopg2.connection' will be used to\n" \ +"instantiate the connection object.\n" static int _psyco_connect_fill_dsn(char *dsn, char *kw, char *v, int i) @@ -241,6 +261,7 @@ static encodingPair encodings[] = { {"SQL_ASCII", "ascii"}, {"LATIN1", "latin_1"}, {"UNICODE", "utf_8"}, + {"UTF8", "utf_8"}, /* some compatibility stuff */ {"latin-1", "latin_1"},