From dd28e90f183972cc2a395094ce3e3f72e861953f Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Fri, 21 Sep 2012 13:55:05 -0400 Subject: run pylint for errors on almost everything, full runs on some selected stuff --- src/lib/Bcfg2/Server/Reports/backends.py | 1 + src/lib/Bcfg2/Server/Reports/manage.py | 6 +++--- src/lib/Bcfg2/Server/Reports/nisauth.py | 6 +++--- src/lib/Bcfg2/Server/Reports/reports/templatetags/bcfg2_tags.py | 4 ++-- .../Bcfg2/Server/Reports/reports/templatetags/syntax_coloring.py | 2 ++ src/lib/Bcfg2/Server/Reports/reports/views.py | 2 +- 6 files changed, 12 insertions(+), 9 deletions(-) (limited to 'src/lib/Bcfg2/Server/Reports') diff --git a/src/lib/Bcfg2/Server/Reports/backends.py b/src/lib/Bcfg2/Server/Reports/backends.py index 85241932f..9f07c104f 100644 --- a/src/lib/Bcfg2/Server/Reports/backends.py +++ b/src/lib/Bcfg2/Server/Reports/backends.py @@ -1,3 +1,4 @@ +import sys from django.contrib.auth.models import User from nisauth import * diff --git a/src/lib/Bcfg2/Server/Reports/manage.py b/src/lib/Bcfg2/Server/Reports/manage.py index 858bddeca..1c8fb03f6 100755 --- a/src/lib/Bcfg2/Server/Reports/manage.py +++ b/src/lib/Bcfg2/Server/Reports/manage.py @@ -1,11 +1,11 @@ #!/usr/bin/env python from django.core.management import execute_manager try: - import settings # Assumed to be in the same directory. + import Bcfg2.settings except ImportError: import sys - sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__) + sys.stderr.write("Error: Can't find the Bcfg2.settings module. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__) sys.exit(1) if __name__ == "__main__": - execute_manager(settings) + execute_manager(Bcfg2.settings) diff --git a/src/lib/Bcfg2/Server/Reports/nisauth.py b/src/lib/Bcfg2/Server/Reports/nisauth.py index b3e37113b..dd1f2f742 100644 --- a/src/lib/Bcfg2/Server/Reports/nisauth.py +++ b/src/lib/Bcfg2/Server/Reports/nisauth.py @@ -1,8 +1,8 @@ +"""Checks with NIS to see if the current user is in the support group""" + import crypt import nis -from Bcfg2.Server.Reports.settings import AUTHORIZED_GROUP - -"""Checks with NIS to see if the current user is in the support group""" +from Bcfg2.settings import AUTHORIZED_GROUP # pylint: disable=E0611 class NISAUTHError(Exception): diff --git a/src/lib/Bcfg2/Server/Reports/reports/templatetags/bcfg2_tags.py b/src/lib/Bcfg2/Server/Reports/reports/templatetags/bcfg2_tags.py index 894353bba..736d6448a 100644 --- a/src/lib/Bcfg2/Server/Reports/reports/templatetags/bcfg2_tags.py +++ b/src/lib/Bcfg2/Server/Reports/reports/templatetags/bcfg2_tags.py @@ -330,7 +330,7 @@ def do_qs(parser, token): try: tag, name, value = token.split_contents() except ValueError: - raise TemplateSyntaxError, "%r tag requires exactly two arguments" \ + raise template.TemplateSyntaxError, "%r tag requires exactly two arguments" \ % token.contents.split()[0] return QsNode(name, value) @@ -367,7 +367,7 @@ def sort_link(parser, token): try: tag, sort_key, text = token.split_contents() except ValueError: - raise TemplateSyntaxError("%r tag requires at least four arguments" \ + raise template.TemplateSyntaxError("%r tag requires at least four arguments" \ % token.split_contents()[0]) return SortLinkNode(sort_key, text) diff --git a/src/lib/Bcfg2/Server/Reports/reports/templatetags/syntax_coloring.py b/src/lib/Bcfg2/Server/Reports/reports/templatetags/syntax_coloring.py index b2814b445..70ef49bc1 100644 --- a/src/lib/Bcfg2/Server/Reports/reports/templatetags/syntax_coloring.py +++ b/src/lib/Bcfg2/Server/Reports/reports/templatetags/syntax_coloring.py @@ -8,6 +8,7 @@ from Bcfg2.Compat import u_str register = template.Library() +# pylint: disable=E0611,F0401 try: from pygments import highlight from pygments.lexers import get_lexer_by_name @@ -16,6 +17,7 @@ try: except: colorize = False +# pylint: enable=E0611,F0401 @register.filter diff --git a/src/lib/Bcfg2/Server/Reports/reports/views.py b/src/lib/Bcfg2/Server/Reports/reports/views.py index e4c38363f..ca9e5f1f9 100644 --- a/src/lib/Bcfg2/Server/Reports/reports/views.py +++ b/src/lib/Bcfg2/Server/Reports/reports/views.py @@ -574,7 +574,7 @@ def prepare_paginated_list(request, context, paged_list, page=1, max_results=25) view, args, kwargs = resolve(request.META['PATH_INFO']) kwargs['page_number'] = total_pages raise PaginationError(HttpResponseRedirect(reverse(view, - kwards=kwargs))) + kwargs=kwargs))) except (Resolver404, NoReverseMatch, ValueError): raise "Accessing beyond last page. Unable to resolve redirect." -- cgit v1.2.3-1-g7c22