diff options
22 files changed, 239 insertions, 76 deletions
diff --git a/doc/source/usage.rst b/doc/source/usage.rst index 11c8c2a..cc4f2fd 100644 --- a/doc/source/usage.rst +++ b/doc/source/usage.rst @@ -76,6 +76,12 @@ positional argument: results = some_reader_api_function(context) some_writer_api_function(context, 5, 10) +.. note:: The ``context.session`` and ``context.connection`` attributes + must be accessed within the scope of an appropriate writer/reader block + (either the decorator or contextmanager approach). An AttributeError is + raised otherwise. + + The scope of transaction and connectivity for both approaches is managed transparently. The configuration for the connection comes from the standard :obj:`oslo_config.cfg.CONF` collection. Additional configurations can be diff --git a/oslo.db/locale/en_GB/LC_MESSAGES/oslo.db-log-error.po b/oslo.db/locale/en_GB/LC_MESSAGES/oslo.db-log-error.po index 254a3c3..584ebaf 100644 --- a/oslo.db/locale/en_GB/LC_MESSAGES/oslo.db-log-error.po +++ b/oslo.db/locale/en_GB/LC_MESSAGES/oslo.db-log-error.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: oslo.db\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2015-07-23 06:14+0000\n" +"POT-Creation-Date: 2015-07-29 06:40+0000\n" "PO-Revision-Date: 2015-03-19 19:04+0000\n" "Last-Translator: Andi Chandler <andi@gowling.com>\n" "Language-Team: English (United Kingdom) (http://www.transifex.com/projects/p/" @@ -17,7 +17,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 1.3\n" +"Generated-By: Babel 2.0\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" msgid "'eventlet' is required for TpoolDbapiWrapper." diff --git a/oslo.db/locale/en_GB/LC_MESSAGES/oslo.db-log-info.po b/oslo.db/locale/en_GB/LC_MESSAGES/oslo.db-log-info.po index a5a8385..b63fa12 100644 --- a/oslo.db/locale/en_GB/LC_MESSAGES/oslo.db-log-info.po +++ b/oslo.db/locale/en_GB/LC_MESSAGES/oslo.db-log-info.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: oslo.db\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2015-07-23 06:14+0000\n" +"POT-Creation-Date: 2015-07-29 06:40+0000\n" "PO-Revision-Date: 2014-11-26 13:04+0000\n" "Last-Translator: Andi Chandler <andi@gowling.com>\n" "Language-Team: English (United Kingdom) (http://www.transifex.com/projects/p/" @@ -17,7 +17,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 1.3\n" +"Generated-By: Babel 2.0\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #, python-format diff --git a/oslo.db/locale/en_GB/LC_MESSAGES/oslo.db-log-warning.po b/oslo.db/locale/en_GB/LC_MESSAGES/oslo.db-log-warning.po index 5a3b8c4..a329fbf 100644 --- a/oslo.db/locale/en_GB/LC_MESSAGES/oslo.db-log-warning.po +++ b/oslo.db/locale/en_GB/LC_MESSAGES/oslo.db-log-warning.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: oslo.db\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2015-07-23 06:14+0000\n" +"POT-Creation-Date: 2015-07-29 06:40+0000\n" "PO-Revision-Date: 2015-03-19 19:04+0000\n" "Last-Translator: Andi Chandler <andi@gowling.com>\n" "Language-Team: English (United Kingdom) (http://www.transifex.com/projects/p/" @@ -17,7 +17,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 1.3\n" +"Generated-By: Babel 2.0\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" msgid "Id not in sort_keys; is sort_keys unique?" diff --git a/oslo.db/locale/en_GB/LC_MESSAGES/oslo.db.po b/oslo.db/locale/en_GB/LC_MESSAGES/oslo.db.po index 88fb668..b1f9926 100644 --- a/oslo.db/locale/en_GB/LC_MESSAGES/oslo.db.po +++ b/oslo.db/locale/en_GB/LC_MESSAGES/oslo.db.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: oslo.db\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2015-07-23 06:14+0000\n" +"POT-Creation-Date: 2015-07-29 06:40+0000\n" "PO-Revision-Date: 2014-09-02 09:18+0000\n" "Last-Translator: Andi Chandler <andi@gowling.com>\n" "Language-Team: English (United Kingdom) (http://www.transifex.com/projects/p/" @@ -17,7 +17,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 1.3\n" +"Generated-By: Babel 2.0\n" msgid "Invalid Parameter: Encoding directive wasn't provided." msgstr "Invalid Parameter: Encoding directive wasn't provided." diff --git a/oslo.db/locale/es/LC_MESSAGES/oslo.db-log-error.po b/oslo.db/locale/es/LC_MESSAGES/oslo.db-log-error.po index 91f8aca..6043104 100644 --- a/oslo.db/locale/es/LC_MESSAGES/oslo.db-log-error.po +++ b/oslo.db/locale/es/LC_MESSAGES/oslo.db-log-error.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: oslo.db\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2015-07-23 06:14+0000\n" +"POT-Creation-Date: 2015-07-29 06:40+0000\n" "PO-Revision-Date: 2015-06-22 21:08+0000\n" "Last-Translator: Adriana Chisco Landazábal <achisco94@gmail.com>\n" "Language-Team: Spanish (http://www.transifex.com/projects/p/oslodb/language/" @@ -17,7 +17,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 1.3\n" +"Generated-By: Babel 2.0\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" msgid "'eventlet' is required for TpoolDbapiWrapper." diff --git a/oslo.db/locale/es/LC_MESSAGES/oslo.db-log-info.po b/oslo.db/locale/es/LC_MESSAGES/oslo.db-log-info.po index 945e5ed..e8d427a 100644 --- a/oslo.db/locale/es/LC_MESSAGES/oslo.db-log-info.po +++ b/oslo.db/locale/es/LC_MESSAGES/oslo.db-log-info.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: oslo.db\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2015-07-23 06:14+0000\n" +"POT-Creation-Date: 2015-07-29 06:40+0000\n" "PO-Revision-Date: 2015-06-22 21:10+0000\n" "Last-Translator: Adriana Chisco Landazábal <achisco94@gmail.com>\n" "Language-Team: Spanish (http://www.transifex.com/projects/p/oslodb/language/" @@ -17,7 +17,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 1.3\n" +"Generated-By: Babel 2.0\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #, python-format diff --git a/oslo.db/locale/es/LC_MESSAGES/oslo.db-log-warning.po b/oslo.db/locale/es/LC_MESSAGES/oslo.db-log-warning.po index 14a3586..d7560d3 100644 --- a/oslo.db/locale/es/LC_MESSAGES/oslo.db-log-warning.po +++ b/oslo.db/locale/es/LC_MESSAGES/oslo.db-log-warning.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: oslo.db\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2015-07-23 06:14+0000\n" +"POT-Creation-Date: 2015-07-29 06:40+0000\n" "PO-Revision-Date: 2015-06-22 21:13+0000\n" "Last-Translator: Adriana Chisco Landazábal <achisco94@gmail.com>\n" "Language-Team: Spanish (http://www.transifex.com/projects/p/oslodb/language/" @@ -17,7 +17,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 1.3\n" +"Generated-By: Babel 2.0\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" msgid "Id not in sort_keys; is sort_keys unique?" diff --git a/oslo.db/locale/es/LC_MESSAGES/oslo.db.po b/oslo.db/locale/es/LC_MESSAGES/oslo.db.po index 0ac9b5c..82cc683 100644 --- a/oslo.db/locale/es/LC_MESSAGES/oslo.db.po +++ b/oslo.db/locale/es/LC_MESSAGES/oslo.db.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: oslo.db\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2015-07-23 06:14+0000\n" +"POT-Creation-Date: 2015-07-29 06:40+0000\n" "PO-Revision-Date: 2015-06-22 21:21+0000\n" "Last-Translator: Adriana Chisco Landazábal <achisco94@gmail.com>\n" "Language-Team: Spanish (http://www.transifex.com/projects/p/oslodb/language/" @@ -17,7 +17,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 1.3\n" +"Generated-By: Babel 2.0\n" msgid "Invalid Parameter: Encoding directive wasn't provided." msgstr "Parámetro no válido: No se proporcionó directiva de codificación." diff --git a/oslo.db/locale/fr/LC_MESSAGES/oslo.db-log-error.po b/oslo.db/locale/fr/LC_MESSAGES/oslo.db-log-error.po index fb6cef6..4e3adca 100644 --- a/oslo.db/locale/fr/LC_MESSAGES/oslo.db-log-error.po +++ b/oslo.db/locale/fr/LC_MESSAGES/oslo.db-log-error.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: oslo.db\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2015-07-23 06:14+0000\n" +"POT-Creation-Date: 2015-07-29 06:40+0000\n" "PO-Revision-Date: 2015-02-18 02:50+0000\n" "Last-Translator: Maxime COQUEREL <max.coquerel@gmail.com>\n" "Language-Team: French (http://www.transifex.com/projects/p/oslodb/language/" @@ -17,7 +17,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 1.3\n" +"Generated-By: Babel 2.0\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" msgid "'eventlet' is required for TpoolDbapiWrapper." diff --git a/oslo.db/locale/fr/LC_MESSAGES/oslo.db-log-info.po b/oslo.db/locale/fr/LC_MESSAGES/oslo.db-log-info.po index a5422dd..9130deb 100644 --- a/oslo.db/locale/fr/LC_MESSAGES/oslo.db-log-info.po +++ b/oslo.db/locale/fr/LC_MESSAGES/oslo.db-log-info.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: oslo.db\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2015-07-23 06:14+0000\n" +"POT-Creation-Date: 2015-07-29 06:40+0000\n" "PO-Revision-Date: 2014-11-23 18:38+0000\n" "Last-Translator: Maxime COQUEREL <max.coquerel@gmail.com>\n" "Language-Team: French (http://www.transifex.com/projects/p/oslodb/language/" @@ -17,7 +17,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 1.3\n" +"Generated-By: Babel 2.0\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" #, python-format diff --git a/oslo.db/locale/fr/LC_MESSAGES/oslo.db-log-warning.po b/oslo.db/locale/fr/LC_MESSAGES/oslo.db-log-warning.po index 5a059bd..c88df94 100644 --- a/oslo.db/locale/fr/LC_MESSAGES/oslo.db-log-warning.po +++ b/oslo.db/locale/fr/LC_MESSAGES/oslo.db-log-warning.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: oslo.db\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2015-07-23 06:14+0000\n" +"POT-Creation-Date: 2015-07-29 06:40+0000\n" "PO-Revision-Date: 2015-03-15 14:48+0000\n" "Last-Translator: openstackjenkins <jenkins@openstack.org>\n" "Language-Team: French (http://www.transifex.com/projects/p/oslodb/language/" @@ -17,7 +17,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 1.3\n" +"Generated-By: Babel 2.0\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" msgid "Id not in sort_keys; is sort_keys unique?" diff --git a/oslo.db/locale/fr/LC_MESSAGES/oslo.db.po b/oslo.db/locale/fr/LC_MESSAGES/oslo.db.po new file mode 100644 index 0000000..4da7424 --- /dev/null +++ b/oslo.db/locale/fr/LC_MESSAGES/oslo.db.po @@ -0,0 +1,74 @@ +# French translations for oslo.db. +# Copyright (C) 2015 ORGANIZATION +# This file is distributed under the same license as the oslo.db project. +# +# Translators: +# Maxime COQUEREL <max.coquerel@gmail.com>, 2014-2015 +msgid "" +msgstr "" +"Project-Id-Version: oslo.db\n" +"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" +"POT-Creation-Date: 2015-07-29 06:40+0000\n" +"PO-Revision-Date: 2015-07-28 21:03+0000\n" +"Last-Translator: Maxime COQUEREL <max.coquerel@gmail.com>\n" +"Language-Team: French (http://www.transifex.com/projects/p/oslodb/language/" +"fr/)\n" +"Plural-Forms: nplurals=2; plural=(n > 1)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.0\n" + +msgid "Invalid Parameter: Encoding directive wasn't provided." +msgstr "Paramètre non valide : La directive encodage n'a pas été fourni." + +#, python-format +msgid "" +"Please specify column %s in col_name_col_instance param. It is required " +"because column has unsupported type by SQLite." +msgstr "" +"Spécifiez la colonne %s dans le paramètre col_name_col_instance. Ceci est " +"obligatoire car la colonne a un type non pris en charge dans SQLite." + +msgid "Sort key supplied was not valid." +msgstr "La clé de tri fournie n'était pas valide." + +#, python-format +msgid "" +"Tables \"%s\" have non utf8 collation, please make sure all tables are " +"CHARSET=utf8" +msgstr "" +"Les tables \"%s\" ont une collation non utf8, assurez-vous que pour toutes " +"les tables CHARSET=utf8." + +msgid "" +"The database is not under version control, but has tables. Please stamp the " +"current version of the schema manually." +msgstr "" +"La base de données n'est pas versionnée, mais contient des tables. Veuillez " +"indiquer manuellement la version courante du schéma." + +#, python-format +msgid "There is no `project_id` column in `%s` table." +msgstr "Il n'y a pas de colonne `project_id` dans la table `%s`." + +msgid "Unknown sort direction, must be 'desc' or 'asc'" +msgstr "Direction d'ordonnancement inconnue, choisir 'desc' ou 'asc'" + +msgid "Unsupported id columns type" +msgstr "Type de colonnes id non pris en charge" + +#, python-format +msgid "" +"col_name_col_instance param has wrong type of column instance for column %s " +"It should be instance of sqlalchemy.Column." +msgstr "" +"Le paramètre col_name_col_instance contient un type d'instance de colonne " +"incorrect pour la colonne %s. Il devrait être une instance de sqlalchemy." +"Column." + +msgid "model should be a subclass of ModelBase" +msgstr "model doit etre une sous-classe de ModelBase" + +msgid "version should be an integer" +msgstr "version doit être un entier" diff --git a/oslo.db/locale/oslo.db-log-critical.pot b/oslo.db/locale/oslo.db-log-critical.pot index 819c9f7..b2ca181 100644 --- a/oslo.db/locale/oslo.db-log-critical.pot +++ b/oslo.db/locale/oslo.db-log-critical.pot @@ -1,19 +1,19 @@ # Translations template for oslo.db. -# Copyright (C) 2014 ORGANIZATION +# Copyright (C) 2015 ORGANIZATION # This file is distributed under the same license as the oslo.db project. -# FIRST AUTHOR <EMAIL@ADDRESS>, 2014. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2015. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: oslo.db 0.3.0.1.g4796d06\n" +"Project-Id-Version: oslo.db 2.2.1.dev2\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2014-07-14 06:03+0000\n" +"POT-Creation-Date: 2015-07-29 06:40+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 1.3\n" +"Generated-By: Babel 2.0\n" diff --git a/oslo.db/locale/oslo.db-log-error.pot b/oslo.db/locale/oslo.db-log-error.pot index 85a4617..08302f6 100644 --- a/oslo.db/locale/oslo.db-log-error.pot +++ b/oslo.db/locale/oslo.db-log-error.pot @@ -6,22 +6,22 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: oslo.db 1.4.1.post9\n" +"Project-Id-Version: oslo.db 2.2.1.dev2\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2015-01-30 06:20+0000\n" +"POT-Creation-Date: 2015-07-29 06:40+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 1.3\n" +"Generated-By: Babel 2.0\n" -#: oslo_db/api.py:120 +#: oslo_db/api.py:142 msgid "DB exceeded retry limit." msgstr "" -#: oslo_db/api.py:124 +#: oslo_db/api.py:166 msgid "DB error." msgstr "" @@ -29,21 +29,21 @@ msgstr "" msgid "'eventlet' is required for TpoolDbapiWrapper." msgstr "" -#: oslo_db/sqlalchemy/exc_filters.py:292 +#: oslo_db/sqlalchemy/exc_filters.py:328 #, python-format msgid "DBAPIError exception wrapped from %s" msgstr "" -#: oslo_db/sqlalchemy/exc_filters.py:303 +#: oslo_db/sqlalchemy/exc_filters.py:339 msgid "DB exception wrapped." msgstr "" -#: oslo_db/sqlalchemy/test_migrations.py:272 +#: oslo_db/sqlalchemy/test_migrations.py:271 #, python-format msgid "Failed to migrate to version %(ver)s on engine %(eng)s" msgstr "" -#: oslo_db/sqlalchemy/migration_cli/ext_migrate.py:61 +#: oslo_db/sqlalchemy/migration_cli/ext_migrate.py:59 msgid "" "Migration number for migrate plugin must be valid integer or empty, if " "you want to downgrade to initial state" diff --git a/oslo.db/locale/oslo.db-log-info.pot b/oslo.db/locale/oslo.db-log-info.pot index aee920a..7788460 100644 --- a/oslo.db/locale/oslo.db-log-info.pot +++ b/oslo.db/locale/oslo.db-log-info.pot @@ -1,28 +1,28 @@ # Translations template for oslo.db. -# Copyright (C) 2014 ORGANIZATION +# Copyright (C) 2015 ORGANIZATION # This file is distributed under the same license as the oslo.db project. -# FIRST AUTHOR <EMAIL@ADDRESS>, 2014. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2015. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: oslo.db 1.0.1.49.g04235f9\n" +"Project-Id-Version: oslo.db 2.2.1.dev2\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2014-11-10 06:02+0000\n" +"POT-Creation-Date: 2015-07-29 06:40+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 1.3\n" +"Generated-By: Babel 2.0\n" -#: oslo/db/sqlalchemy/provision.py:151 oslo/db/sqlalchemy/provision.py:162 +#: oslo_db/sqlalchemy/provision.py:221 oslo_db/sqlalchemy/provision.py:232 #, python-format msgid "The %(dbapi)s backend is unavailable: %(err)s" msgstr "" -#: oslo/db/sqlalchemy/utils.py:415 +#: oslo_db/sqlalchemy/utils.py:427 #, python-format msgid "Deleting duplicated row with id: %(id)s from table: %(table)s" msgstr "" diff --git a/oslo.db/locale/oslo.db-log-warning.pot b/oslo.db/locale/oslo.db-log-warning.pot index 34ea803..089785d 100644 --- a/oslo.db/locale/oslo.db-log-warning.pot +++ b/oslo.db/locale/oslo.db-log-warning.pot @@ -6,39 +6,39 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: oslo.db 1.7.0.post3\n" +"Project-Id-Version: oslo.db 2.2.1.dev2\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2015-03-19 06:01+0000\n" +"POT-Creation-Date: 2015-07-29 06:40+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 1.3\n" +"Generated-By: Babel 2.0\n" -#: oslo_db/sqlalchemy/session.py:510 +#: oslo_db/sqlalchemy/engines.py:250 msgid "Unable to detect effective SQL mode" msgstr "" -#: oslo_db/sqlalchemy/session.py:517 +#: oslo_db/sqlalchemy/engines.py:257 #, python-format msgid "MySQL SQL mode is '%s', consider enabling TRADITIONAL or STRICT_ALL_TABLES" msgstr "" -#: oslo_db/sqlalchemy/session.py:585 +#: oslo_db/sqlalchemy/engines.py:325 #, python-format msgid "SQL connection failed. %s attempts left." msgstr "" -#: oslo_db/sqlalchemy/session.py:632 +#: oslo_db/sqlalchemy/engines.py:350 #, python-format msgid "" "Parent process %(orig)s forked (%(newproc)s) with an open database " "connection, which is being discarded and recreated." msgstr "" -#: oslo_db/sqlalchemy/utils.py:127 +#: oslo_db/sqlalchemy/utils.py:100 msgid "Id not in sort_keys; is sort_keys unique?" msgstr "" diff --git a/oslo.db/locale/oslo.db.pot b/oslo.db/locale/oslo.db.pot index 2135ea9..c7064cc 100644 --- a/oslo.db/locale/oslo.db.pot +++ b/oslo.db/locale/oslo.db.pot @@ -1,82 +1,82 @@ # Translations template for oslo.db. -# Copyright (C) 2014 ORGANIZATION +# Copyright (C) 2015 ORGANIZATION # This file is distributed under the same license as the oslo.db project. -# FIRST AUTHOR <EMAIL@ADDRESS>, 2014. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2015. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: oslo.db 0.4.0.14.g0e854f2\n" +"Project-Id-Version: oslo.db 2.2.1.dev2\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2014-09-02 06:05+0000\n" +"POT-Creation-Date: 2015-07-29 06:40+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 1.3\n" +"Generated-By: Babel 2.0\n" -#: oslo/db/exception.py:133 +#: oslo_db/exception.py:150 msgid "Invalid Parameter: Encoding directive wasn't provided." msgstr "" -#: oslo/db/exception.py:161 +#: oslo_db/exception.py:186 msgid "Sort key supplied was not valid." msgstr "" -#: oslo/db/sqlalchemy/migration.py:72 +#: oslo_db/sqlalchemy/migration.py:72 msgid "version should be an integer" msgstr "" -#: oslo/db/sqlalchemy/migration.py:108 +#: oslo_db/sqlalchemy/migration.py:112 #, python-format msgid "" "Tables \"%s\" have non utf8 collation, please make sure all tables are " "CHARSET=utf8" msgstr "" -#: oslo/db/sqlalchemy/migration.py:132 +#: oslo_db/sqlalchemy/migration.py:136 msgid "" "The database is not under version control, but has tables. Please stamp " "the current version of the schema manually." msgstr "" -#: oslo/db/sqlalchemy/utils.py:122 +#: oslo_db/sqlalchemy/utils.py:122 msgid "Unknown sort direction, must be 'desc' or 'asc'" msgstr "" -#: oslo/db/sqlalchemy/utils.py:165 +#: oslo_db/sqlalchemy/utils.py:181 #, python-format msgid "" "There is no `deleted` column in `%s` table. Project doesn't use soft-" "deleted feature." msgstr "" -#: oslo/db/sqlalchemy/utils.py:179 +#: oslo_db/sqlalchemy/utils.py:195 #, python-format msgid "There is no `project_id` column in `%s` table." msgstr "" -#: oslo/db/sqlalchemy/utils.py:291 +#: oslo_db/sqlalchemy/utils.py:307 msgid "model should be a subclass of ModelBase" msgstr "" -#: oslo/db/sqlalchemy/utils.py:340 +#: oslo_db/sqlalchemy/utils.py:377 #, python-format msgid "" "Please specify column %s in col_name_col_instance param. It is required " "because column has unsupported type by SQLite." msgstr "" -#: oslo/db/sqlalchemy/utils.py:346 +#: oslo_db/sqlalchemy/utils.py:383 #, python-format msgid "" "col_name_col_instance param has wrong type of column instance for column " "%s It should be instance of sqlalchemy.Column." msgstr "" -#: oslo/db/sqlalchemy/utils.py:454 +#: oslo_db/sqlalchemy/utils.py:448 msgid "Unsupported id columns type" msgstr "" diff --git a/oslo_db/exception.py b/oslo_db/exception.py index c1620e1..2b2df30 100644 --- a/oslo_db/exception.py +++ b/oslo_db/exception.py @@ -208,12 +208,12 @@ class RetryRequest(Exception): class NoEngineContextEstablished(AttributeError): - """Error raised for non-present enginefacade attribute access. + """Error raised for enginefacade attribute access with no context. This applies to the ``session`` and ``connection`` attributes of a user-defined context and/or RequestContext object, when they - are accessed outside of the scope of an enginefacade decorator + are accessed *outside* of the scope of an enginefacade decorator or context manager. The exception is a subclass of AttributeError so that @@ -224,6 +224,23 @@ class NoEngineContextEstablished(AttributeError): """ +class ContextNotRequestedError(AttributeError): + """Error raised when requesting a not-setup enginefacade attribute. + + This applies to the ``session`` and ``connection`` attributes + of a user-defined context and/or RequestContext object, when they + are accessed *within* the scope of an enginefacade decorator + or context manager, but the context has not requested that + attribute (e.g. like "with enginefacade.connection.using(context)" + and "context.session" is requested). + + """ + + +class CantStartEngineError(Exception): + """Error raised when the enginefacade cannot start up correctly.""" + + class NotSupportedWarning(Warning): """Warn that an argument or call that was passed is not supported. diff --git a/oslo_db/sqlalchemy/enginefacade.py b/oslo_db/sqlalchemy/enginefacade.py index 4497a50..cf7f149 100644 --- a/oslo_db/sqlalchemy/enginefacade.py +++ b/oslo_db/sqlalchemy/enginefacade.py @@ -314,7 +314,6 @@ class _TransactionFactory(object): # for the lock. if self._started: return - self._started = True if conf is False: conf = cfg.CONF @@ -349,8 +348,16 @@ class _TransactionFactory(object): self.synchronous_reader = self._facade_cfg['synchronous_reader'] + # set up _started last, so that in case of exceptions + # we try the whole thing again and report errors + # correctly + self._started = True + def _setup_for_connection( self, sql_connection, engine_kwargs, maker_kwargs): + if sql_connection is None: + raise exception.CantStartEngineError( + "No sql_connection parameter is established") engine = engines.create_engine( sql_connection=sql_connection, **engine_kwargs) sessionmaker = orm.get_maker(engine=engine, **maker_kwargs) @@ -736,7 +743,13 @@ def _context_descriptor(attr=None): % (context, attr) ) else: - return getter(transaction_context) + result = getter(transaction_context) + if result is None: + raise exception.ContextNotRequestedError( + "The '%s' context attribute was requested but " + "it has not been established for this context." % attr + ) + return result return property(_property_for_context) diff --git a/oslo_db/tests/sqlalchemy/test_enginefacade.py b/oslo_db/tests/sqlalchemy/test_enginefacade.py index fe8030c..6893a93 100644 --- a/oslo_db/tests/sqlalchemy/test_enginefacade.py +++ b/oslo_db/tests/sqlalchemy/test_enginefacade.py @@ -770,6 +770,36 @@ class MockFacadeTest(oslo_test_base.BaseTestCase): conn.execute("test1") conn.execute("test2") + def test_session_context_notrequested_exception(self): + context = oslo_context.RequestContext() + + with enginefacade.reader.connection.using(context): + exc = self.assertRaises( + exception.ContextNotRequestedError, + getattr, context, 'session' + ) + + self.assertRegexpMatches( + exc.args[0], + "The 'session' context attribute was requested but it has " + "not been established for this context." + ) + + def test_connection_context_notrequested_exception(self): + context = oslo_context.RequestContext() + + with enginefacade.reader.using(context): + exc = self.assertRaises( + exception.ContextNotRequestedError, + getattr, context, 'connection' + ) + + self.assertRegexpMatches( + exc.args[0], + "The 'connection' context attribute was requested but it has " + "not been established for this context." + ) + def test_session_context_exception(self): context = oslo_context.RequestContext() exc = self.assertRaises( @@ -1052,19 +1082,28 @@ class ThreadingTest(test_base.DbTestCase): @enginefacade.writer.connection def go_one(context): - self.assertIsNone(context.session) + self.assertRaises( + exception.ContextNotRequestedError, + getattr, context, "session" + ) self.assertIsNotNone(context.connection) self.ident = 2 go_two(context) self.ident = 1 - self.assertIsNone(context.session) + self.assertRaises( + exception.ContextNotRequestedError, + getattr, context, "session" + ) self.assertIsNotNone(context.connection) @enginefacade.reader def go_two(context): - self.assertIsNone(context.connection) + self.assertRaises( + exception.ContextNotRequestedError, + getattr, context, "connection" + ) self.assertIsNotNone(context.session) context = oslo_context.RequestContext() @@ -1652,5 +1691,19 @@ class ConfigOptionsTest(oslo_test_base.BaseTestCase): str(w[-1].message) ) + def test_no_engine(self): + factory = enginefacade._TransactionFactory() + + self.assertRaises( + exception.CantStartEngineError, + factory._create_session, enginefacade._WRITER + ) + + self.assertRaises( + exception.CantStartEngineError, + factory._create_session, enginefacade._WRITER + ) + + # TODO(zzzeek): test configuration options, e.g. like # test_sqlalchemy->test_creation_from_config diff --git a/test-requirements.txt b/test-requirements.txt index dd16eb9..310eba6 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -15,7 +15,7 @@ psycopg2 python-subunit>=0.0.18 sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2 oslosphinx>=2.5.0 # Apache-2.0 -oslotest>=1.7.0 # Apache-2.0 +oslotest>=1.9.0 # Apache-2.0 testrepository>=0.0.18 testtools>=1.4.0 tempest-lib>=0.6.1 |