Django

Code

Changeset 2058

Show
Ignore:
Timestamp:
01/18/06 19:06:12 (3 years ago)
Author:
adrian
Message:

Fixed a bunch of errors detected by pychecker -- unneeded imports and shadows of builtin variable names

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/bin/compile-messages.py

    r2056 r2058  
    1717 
    1818    for (dirpath, dirnames, filenames) in os.walk(basedir): 
    19         for file in filenames: 
    20             if file.endswith('.po'): 
    21                 sys.stderr.write('processing file %s in %s\n' % (file, dirpath)) 
    22                 pf = os.path.splitext(os.path.join(dirpath, file))[0] 
     19        for f in filenames: 
     20            if f.endswith('.po'): 
     21                sys.stderr.write('processing file %s in %s\n' % (f, dirpath)) 
     22                pf = os.path.splitext(os.path.join(dirpath, f))[0] 
    2323                cmd = 'msgfmt -o "%s.mo" "%s.po"' % (pf, pf) 
    2424                os.system(cmd) 
  • django/trunk/django/bin/unique-messages.py

    r2056 r2058  
    33import os 
    44import sys 
    5 import getopt 
    65 
    76def unique_messages(): 
     
    1716 
    1817    for (dirpath, dirnames, filenames) in os.walk(basedir): 
    19         for file in filenames: 
    20             if file.endswith('.po'): 
    21                 sys.stderr.write('processing file %s in %s\n' % (file, dirpath)) 
    22                 pf = os.path.splitext(os.path.join(dirpath, file))[0] 
     18        for f in filenames: 
     19            if f.endswith('.po'): 
     20                sys.stderr.write('processing file %s in %s\n' % (f, dirpath)) 
     21                pf = os.path.splitext(os.path.join(dirpath, f))[0] 
    2322                cmd = 'msguniq "%s.po"' % pf 
    2423                stdout = os.popen(cmd) 
  • django/trunk/django/utils/html.py

    r1969 r2058  
    1313word_split_re = re.compile(r'(\s+)') 
    1414punctuation_re = re.compile('^(?P<lead>(?:%s)*)(?P<middle>.*?)(?P<trail>(?:%s)*)$' % \ 
    15     ('|'.join([re.escape(p) for p in LEADING_PUNCTUATION]), 
    16     '|'.join([re.escape(p) for p in TRAILING_PUNCTUATION]))) 
     15    ('|'.join([re.escape(x) for x in LEADING_PUNCTUATION]), 
     16    '|'.join([re.escape(x) for x in TRAILING_PUNCTUATION]))) 
    1717simple_email_re = re.compile(r'^\S+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+$') 
    1818link_target_attribute_re = re.compile(r'(<a [^>]*?)target=[^\s>]+') 
    1919html_gunk_re = re.compile(r'(?:<br clear="all">|<i><\/i>|<b><\/b>|<em><\/em>|<strong><\/strong>|<\/?smallcaps>|<\/?uppercase>)', re.IGNORECASE) 
    20 hard_coded_bullets_re = re.compile(r'((?:<p>(?:%s).*?[a-zA-Z].*?</p>\s*)+)' % '|'.join([re.escape(d) for d in DOTS]), re.DOTALL) 
     20hard_coded_bullets_re = re.compile(r'((?:<p>(?:%s).*?[a-zA-Z].*?</p>\s*)+)' % '|'.join([re.escape(x) for x in DOTS]), re.DOTALL) 
    2121trailing_empty_content_re = re.compile(r'(?:<p>(?:&nbsp;|\s|<br \/>)*?</p>\s*)+\Z') 
     22del x # Temporary variable 
    2223 
    2324def escape(html): 
  • django/trunk/django/views/debug.py

    r1825 r2058  
    33from django.utils.html import escape 
    44from django.utils.httpwrappers import HttpResponseServerError, HttpResponseNotFound 
    5 import inspect, os, re, sys 
     5import os, re 
    66from itertools import count, izip 
    77from os.path import dirname, join as pathjoin 
  • django/trunk/django/views/i18n.py

    r1560 r2058  
    1 import re 
    2 import os 
    3  
    4 import gettext as gettext_module 
    5  
    61from django.utils import httpwrappers 
    72from django.utils.translation import check_for_language, activate, to_locale, get_language 
    83from django.utils.text import javascript_quote 
    94from django.conf import settings 
     5import os 
     6import gettext as gettext_module 
    107 
    118def set_language(request): 
     
    146143            try: 
    147144                catalog = gettext_module.translation(domain, path, [default_locale]) 
    148             except IOError, e
     145            except IOError
    149146                catalog = None 
    150147            if catalog is not None: 
     
    155152            try: 
    156153                catalog = gettext_module.translation(domain, path, [locale]) 
    157             except IOError, e
     154            except IOError
    158155                catalog = None 
    159156            if catalog is not None: