add disable_logging option

This commit is contained in:
iElectric 2009-07-10 19:42:42 +02:00
parent 1c166845f8
commit a186d2edf2
8 changed files with 32 additions and 17 deletions

View File

@ -1,7 +1,7 @@
0.5.5
0.6.0
-----
- use Python logging for output, can be shut down by passing ``logging=False`` to :func:`migrate.versioning.shell.main`
- use Python logging for output, can be shut down by passing ``--disable_logging`` to :func:`migrate.versioning.shell.main`
- `url` parameter can also be an :class:`Engine` instance (this usage is discouraged though sometimes necessary)
- added support for SQLAlchemy 0.6 (missing oracle and firebird) by Michael Bayer
- alter, create, drop column / rename table / rename index constructs now accept `alter_metadata` parameter. If True, it will modify Column/Table objects according to changes. Otherwise, everything will be untouched.
@ -20,7 +20,7 @@
- majoy update to documentation
- :ref:`dialect support <dialect-support>` table was added to documentation
.. _backwards-055:
.. _backwards-06:
**Backward incompatible changes**:

View File

@ -72,7 +72,7 @@ Given a standard SQLAlchemy table::
.. note::
Since version ``0.5.5`` you can pass primary_key_name, index_name and unique_name to column.create method to issue ALTER TABLE ADD CONSTRAINT after changing the column. Note for multi columns constraints and other advanced configuration, check :ref:`constraint tutorial <constraint-tutorial>`.
Since version ``0.6.0`` you can pass primary_key_name, index_name and unique_name to column.create method to issue ALTER TABLE ADD CONSTRAINT after changing the column. Note for multi columns constraints and other advanced configuration, check :ref:`constraint tutorial <constraint-tutorial>`.
.. _table-rename:

View File

@ -29,7 +29,7 @@
.. warning::
Version **0.5.5** breaks backward compatability, please read :ref:`changelog <backwards-055>` for more info.
Version **0.6.0** breaks backward compatability, please read :ref:`changelog <backwards-06>` for more info.
Download and Development

View File

@ -173,7 +173,7 @@ class UniqueConstraint(ConstraintChangeset, schema.UniqueConstraint):
:type table: Table instance
:type cols: strings or Column instances
.. versionadded:: 0.5.5
.. versionadded:: 0.6.0
"""
__migrate_visit_name__ = 'migrate_unique_constraint'

View File

@ -2,9 +2,9 @@
This module provides an external API to the versioning system.
.. versionchanged:: 0.6.0
:func:`migrate.versioning.api.test` and schema diff functions \
changed order of positional arguments so all accept `url` and `repository`\
as first arguments.
:func:`migrate.versioning.api.test` and schema diff functions
changed order of positional arguments so all accept `url` and `repository`
as first arguments.
.. versionchanged:: 0.5.4
``--preview_sql`` displays source file when using SQL scripts.

View File

@ -57,8 +57,8 @@ def main(argv=None, **kwargs):
kwargs are default options that can be overriden with passing
--some_option as command line option
:param logging: Let migrate configure logging
:type logging: bool
:param disable_logging: Let migrate configure logging
:type disable_logging: bool
"""
argv = argv or list(sys.argv[1:])
commands = list(api.__all__)
@ -73,8 +73,17 @@ def main(argv=None, **kwargs):
""" % '\n\t'.join(commands)
parser = PassiveOptionParser(usage=usage)
parser.add_option("-v", "--verbose", action="store_true", dest="verbose")
parser.add_option("-d", "--debug", action="store_true", dest="debug")
#parser.add_option("-v", "--verbose", action="store_true", dest="verbose")
parser.add_option("-d", "--debug",
action="store_true",
dest="debug",
default=False,
help="Shortcut to turn on DEBUG mode for logging")
parser.add_option("-q", "--disable_logging",
action="store_true",
dest="disable_logging",
default=False,
help="Use this option to disable logging configuration")
help_commands = ['help', '-h', '--help']
HELP = False
@ -144,8 +153,12 @@ def main(argv=None, **kwargs):
# apply overrides
kwargs.update(override_kwargs)
# configure options
for key, value in options.__dict__.iteritems():
kwargs.setdefault(key, value)
# configure logging
if asbool(kwargs.pop('logging', True)):
if not asbool(kwargs.pop('disable_logging', False)):
logger = logging.getLogger()
logger.setLevel(logging.INFO)
formatter = logging.Formatter("%(message)s")

View File

@ -7,8 +7,8 @@ tag_svn_revision = 1
tag_build = .dev
[nosetests]
#pdb = true
#pdb-failures = true
pdb = true
pdb-failures = true
#stop = true
[aliases]

View File

@ -35,7 +35,9 @@ class TestShellCommands(Shell):
"""Try to shutdown logging output"""
repos = self.tmp_repos()
result = self.env.run('migrate create %s repository_name' % repos)
result = self.env.run('migrate version %s --logging=False' % repos)
result = self.env.run('migrate version %s --disable_logging' % repos)
self.assertEqual(result.stdout, '')
result = self.env.run('migrate version %s -q' % repos)
self.assertEqual(result.stdout, '')
# TODO: assert logging messages to 0