From 97fb0411763063d5f6163618e5aab2f3700f630f Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Sat, 25 Jul 2015 03:38:52 +0200 Subject: Fix errros with old pylint/pep8 For Python2.4 we need older version of pylint and pep8, that finds some more errors: - On python2.4 _ast is not available and pylint uses compiler.ast, that seems to have some problems with the line numbers if a comment is following the pylint disable marker. - In python2.4 there is no xml.etree. But we can ignore this error because Client.XML tries to find a suitable library. - Some small formatting issues. --- src/lib/Bcfg2/DBSettings.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/lib/Bcfg2/DBSettings.py') diff --git a/src/lib/Bcfg2/DBSettings.py b/src/lib/Bcfg2/DBSettings.py index 254dfa4b8..ddcf66b44 100644 --- a/src/lib/Bcfg2/DBSettings.py +++ b/src/lib/Bcfg2/DBSettings.py @@ -21,7 +21,8 @@ try: except ImportError: HAS_SOUTH = False -settings = dict( # pylint: disable=C0103 +# pylint: disable=C0103 +settings = dict( TIME_ZONE=None, TEMPLATE_DEBUG=False, DEBUG=False, @@ -106,8 +107,8 @@ def finalize_django_config(opts=None, silent=False): OPTIONS=opts.db_opts, SCHEMA=opts.db_schema)) - if hasattr(opts, "reporting_db_engine") and \ - opts.reporting_db_engine is not None: + if (hasattr(opts, "reporting_db_engine") and + opts.reporting_db_engine is not None): settings['DATABASES']['Reporting'] = dict( ENGINE="django.db.backends.%s" % opts.reporting_db_engine, NAME=opts.reporting_db_name, @@ -180,9 +181,9 @@ def upgrade_to_django_migrations(database, logger): cursor.cursor.execute('SELECT migration FROM south_migrationhistory') applied_migrations = [name for (name,) in cursor.fetchall()] last_migration = sorted(applied_migrations).pop() + # django.db.DatabaseError is not working here, because we are + # using the low level api to interact directly with the database except: # pylint: disable=W0702 - # django.db.DatabaseError is not working here, because we are - # using the low level api to interact directly with the database logger.debug("No south migration detected for database: %s." % database) -- cgit v1.2.3-1-g7c22