mirror of
https://github.com/django/django.git
synced 2025-10-26 23:26:08 +00:00
Fixed #21266 -- Fixed E201,E202 pep8 warnings.
This commit is contained in:
committed by
Tim Graham
parent
42a67ec1cd
commit
83b9bfea44
@@ -403,7 +403,7 @@ class InlineValidator(BaseValidator):
|
||||
def check_type(cls, attr, type_):
|
||||
if getattr(cls, attr, None) is not None and not isinstance(getattr(cls, attr), type_):
|
||||
raise ImproperlyConfigured("'%s.%s' should be a %s."
|
||||
% (cls.__name__, attr, type_.__name__ ))
|
||||
% (cls.__name__, attr, type_.__name__))
|
||||
|
||||
def check_isseq(cls, label, obj):
|
||||
if not isinstance(obj, (list, tuple)):
|
||||
|
||||
@@ -238,8 +238,8 @@ class CommentModerator(object):
|
||||
return
|
||||
recipient_list = [manager_tuple[1] for manager_tuple in settings.MANAGERS]
|
||||
t = loader.get_template('comments/comment_notification_email.txt')
|
||||
c = Context({ 'comment': comment,
|
||||
'content_object': content_object })
|
||||
c = Context({'comment': comment,
|
||||
'content_object': content_object})
|
||||
subject = '[%s] New comment posted on "%s"' % (get_current_site(request).name,
|
||||
content_object)
|
||||
message = t.render(c)
|
||||
|
||||
@@ -32,7 +32,7 @@ class PostGISIntrospection(DatabaseIntrospection):
|
||||
try:
|
||||
cursor.execute(oid_sql, ('geometry',))
|
||||
GEOM_TYPE = cursor.fetchone()[0]
|
||||
postgis_types = { GEOM_TYPE : 'GeometryField' }
|
||||
postgis_types = {GEOM_TYPE : 'GeometryField'}
|
||||
if self.connection.ops.geography:
|
||||
cursor.execute(oid_sql, ('geography',))
|
||||
GEOG_TYPE = cursor.fetchone()[0]
|
||||
|
||||
@@ -226,8 +226,8 @@ class GeoSQLCompiler(compiler.SQLCompiler):
|
||||
# transformed geometries have an SRID different than that of the
|
||||
# field -- this is only used by `transform` for Oracle and
|
||||
# SpatiaLite backends.
|
||||
if self.query.transformed_srid and ( self.connection.ops.oracle or
|
||||
self.connection.ops.spatialite ):
|
||||
if self.query.transformed_srid and (self.connection.ops.oracle or
|
||||
self.connection.ops.spatialite):
|
||||
sel_fmt = "'SRID=%d;'||%s" % (self.query.transformed_srid, sel_fmt)
|
||||
else:
|
||||
sel_fmt = '%s'
|
||||
|
||||
@@ -36,8 +36,8 @@ class GeoWhereNode(WhereNode):
|
||||
def _prepare_data(self, data):
|
||||
if isinstance(data, (list, tuple)):
|
||||
obj, lookup_type, value = data
|
||||
if ( isinstance(obj, Constraint) and
|
||||
isinstance(obj.field, GeometryField) ):
|
||||
if (isinstance(obj, Constraint) and
|
||||
isinstance(obj.field, GeometryField)):
|
||||
data = (GeoConstraint(obj), lookup_type, value)
|
||||
return super(GeoWhereNode, self)._prepare_data(data)
|
||||
|
||||
|
||||
@@ -19,15 +19,16 @@ class OGRIndexError(OGRException, KeyError):
|
||||
#### OGR error checking codes and routine ####
|
||||
|
||||
# OGR Error Codes
|
||||
OGRERR_DICT = { 1 : (OGRException, 'Not enough data.'),
|
||||
2 : (OGRException, 'Not enough memory.'),
|
||||
3 : (OGRException, 'Unsupported geometry type.'),
|
||||
4 : (OGRException, 'Unsupported operation.'),
|
||||
5 : (OGRException, 'Corrupt data.'),
|
||||
6 : (OGRException, 'OGR failure.'),
|
||||
7 : (SRSException, 'Unsupported SRS.'),
|
||||
8 : (OGRException, 'Invalid handle.'),
|
||||
}
|
||||
OGRERR_DICT = {
|
||||
1: (OGRException, 'Not enough data.'),
|
||||
2: (OGRException, 'Not enough memory.'),
|
||||
3: (OGRException, 'Unsupported geometry type.'),
|
||||
4: (OGRException, 'Unsupported operation.'),
|
||||
5: (OGRException, 'Corrupt data.'),
|
||||
6: (OGRException, 'OGR failure.'),
|
||||
7: (SRSException, 'Unsupported SRS.'),
|
||||
8: (OGRException, 'Invalid handle.'),
|
||||
}
|
||||
OGRERR_NONE = 0
|
||||
|
||||
def check_err(code):
|
||||
|
||||
@@ -178,17 +178,18 @@ class OFTStringList(Field): pass
|
||||
class OFTWideStringList(Field): pass
|
||||
|
||||
# Class mapping dictionary for OFT Types and reverse mapping.
|
||||
OGRFieldTypes = { 0 : OFTInteger,
|
||||
1 : OFTIntegerList,
|
||||
2 : OFTReal,
|
||||
3 : OFTRealList,
|
||||
4 : OFTString,
|
||||
5 : OFTStringList,
|
||||
6 : OFTWideString,
|
||||
7 : OFTWideStringList,
|
||||
8 : OFTBinary,
|
||||
9 : OFTDate,
|
||||
10 : OFTTime,
|
||||
11 : OFTDateTime,
|
||||
}
|
||||
OGRFieldTypes = {
|
||||
0: OFTInteger,
|
||||
1: OFTIntegerList,
|
||||
2: OFTReal,
|
||||
3: OFTRealList,
|
||||
4: OFTString,
|
||||
5: OFTStringList,
|
||||
6: OFTWideString,
|
||||
7: OFTWideStringList,
|
||||
8: OFTBinary,
|
||||
9: OFTDate,
|
||||
10: OFTTime,
|
||||
11: OFTDateTime,
|
||||
}
|
||||
ROGRFieldTypes = dict((cls, num) for num, cls in OGRFieldTypes.items())
|
||||
|
||||
@@ -151,8 +151,8 @@ class OGRGeometry(GDALBase):
|
||||
def from_bbox(cls, bbox):
|
||||
"Constructs a Polygon from a bounding box (4-tuple)."
|
||||
x0, y0, x1, y1 = bbox
|
||||
return OGRGeometry( 'POLYGON((%s %s, %s %s, %s %s, %s %s, %s %s))' % (
|
||||
x0, y0, x0, y1, x1, y1, x1, y0, x0, y0) )
|
||||
return OGRGeometry('POLYGON((%s %s, %s %s, %s %s, %s %s, %s %s))' % (
|
||||
x0, y0, x0, y1, x1, y1, x1, y0, x0, y0))
|
||||
|
||||
### Geometry set-like operations ###
|
||||
# g = g1 | g2
|
||||
|
||||
@@ -205,7 +205,7 @@ class OGRGeomTest(unittest.TestCase, TestDataMixin):
|
||||
|
||||
# Testing `from_bbox` class method
|
||||
bbox = (-180, -90, 180, 90)
|
||||
p = OGRGeometry.from_bbox( bbox )
|
||||
p = OGRGeometry.from_bbox(bbox)
|
||||
self.assertEqual(bbox, p.extent)
|
||||
|
||||
prev = OGRGeometry('POINT(0 0)')
|
||||
|
||||
@@ -22,9 +22,10 @@ class GeoIPRecord(Structure):
|
||||
('continent_code', c_char_p),
|
||||
]
|
||||
geoip_char_fields = [name for name, ctype in GeoIPRecord._fields_ if ctype is c_char_p]
|
||||
geoip_encodings = { 0: 'iso-8859-1',
|
||||
1: 'utf8',
|
||||
}
|
||||
geoip_encodings = {
|
||||
0: 'iso-8859-1',
|
||||
1: 'utf8',
|
||||
}
|
||||
|
||||
class GeoIPTag(Structure): pass
|
||||
|
||||
|
||||
@@ -96,9 +96,9 @@ class ListMixin(object):
|
||||
indexRange = range(*index.indices(origLen))
|
||||
|
||||
newLen = origLen - len(indexRange)
|
||||
newItems = ( self._get_single_internal(i)
|
||||
newItems = (self._get_single_internal(i)
|
||||
for i in xrange(origLen)
|
||||
if i not in indexRange )
|
||||
if i not in indexRange)
|
||||
|
||||
self._rebuild(newLen, newItems)
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ class ListMixinTest(unittest.TestCase):
|
||||
self.assertEqual(pl, ul[:], 'set slice [%d:%d]' % (i, j))
|
||||
|
||||
for k in self.step_range():
|
||||
ssl = nextRange( len(ul[i:j:k]) )
|
||||
ssl = nextRange(len(ul[i:j:k]))
|
||||
ul[i:j:k] = ssl
|
||||
pl[i:j:k] = ssl
|
||||
self.assertEqual(pl, ul[:], 'set slice [%d:%d:%d]' % (i, j, k))
|
||||
@@ -127,12 +127,12 @@ class ListMixinTest(unittest.TestCase):
|
||||
self.assertRaises(ValueError, setfcn, ul, i, j, k, sliceLen - 1)
|
||||
|
||||
for k in self.step_range():
|
||||
ssl = nextRange( len(ul[i::k]) )
|
||||
ssl = nextRange(len(ul[i::k]))
|
||||
ul[i::k] = ssl
|
||||
pl[i::k] = ssl
|
||||
self.assertEqual(pl, ul[:], 'set slice [%d::%d]' % (i, k))
|
||||
|
||||
ssl = nextRange( len(ul[:i:k]) )
|
||||
ssl = nextRange(len(ul[:i:k]))
|
||||
ul[:i:k] = ssl
|
||||
pl[:i:k] = ssl
|
||||
self.assertEqual(pl, ul[:], 'set slice [:%d:%d]' % (i, k))
|
||||
|
||||
@@ -95,7 +95,7 @@ class GoogleZoom(object):
|
||||
lon = (px[0] - npix) / self._degpp[zoom]
|
||||
|
||||
# Calculating the latitude value.
|
||||
lat = RTOD * ( 2 * atan(exp((px[1] - npix)/ (-1.0 * self._radpp[zoom]))) - 0.5 * pi)
|
||||
lat = RTOD * (2 * atan(exp((px[1] - npix)/ (-1.0 * self._radpp[zoom]))) - 0.5 * pi)
|
||||
|
||||
# Returning the longitude, latitude coordinate pair.
|
||||
return (lon, lat)
|
||||
|
||||
@@ -140,7 +140,7 @@ class DistanceTest(TestCase):
|
||||
|
||||
# Testing geodetic distance calculation with a non-point geometry
|
||||
# (a LineString of Wollongong and Shellharbour coords).
|
||||
ls = LineString( ( (150.902, -34.4245), (150.87, -34.5789) ) )
|
||||
ls = LineString(((150.902, -34.4245), (150.87, -34.5789)))
|
||||
if oracle or connection.ops.geography:
|
||||
# Reference query:
|
||||
# SELECT ST_distance_sphere(point, ST_GeomFromText('LINESTRING(150.9020 -34.4245,150.8700 -34.5789)', 4326)) FROM distapp_australiacity ORDER BY name;
|
||||
|
||||
@@ -46,7 +46,7 @@ city_dict = dict((name, coords) for name, coords in city_data)
|
||||
interstate_data = (
|
||||
('I-45',
|
||||
'LINESTRING(-95.3708481 29.7765870 11.339,-95.3694580 29.7787980 4.536,-95.3690305 29.7797359 9.762,-95.3691886 29.7812450 12.448,-95.3696447 29.7850144 10.457,-95.3702511 29.7868518 9.418,-95.3706724 29.7881286 14.858,-95.3711632 29.7896157 15.386,-95.3714525 29.7936267 13.168,-95.3717848 29.7955007 15.104,-95.3717719 29.7969804 16.516,-95.3717305 29.7982117 13.923,-95.3717254 29.8000778 14.385,-95.3719875 29.8013539 15.160,-95.3720575 29.8026785 15.544,-95.3721321 29.8040912 14.975,-95.3722074 29.8050998 15.688,-95.3722779 29.8060430 16.099,-95.3733818 29.8076750 15.197,-95.3741563 29.8103686 17.268,-95.3749458 29.8129927 19.857,-95.3763564 29.8144557 15.435)',
|
||||
( 11.339, 4.536, 9.762, 12.448, 10.457, 9.418, 14.858,
|
||||
(11.339, 4.536, 9.762, 12.448, 10.457, 9.418, 14.858,
|
||||
15.386, 13.168, 15.104, 16.516, 13.923, 14.385, 15.16 ,
|
||||
15.544, 14.975, 15.688, 16.099, 15.197, 17.268, 19.857,
|
||||
15.435),
|
||||
|
||||
@@ -459,12 +459,14 @@ class GeoQuerySetTest(TestCase):
|
||||
@no_spatialite
|
||||
def test_force_rhr(self):
|
||||
"Testing GeoQuerySet.force_rhr()."
|
||||
rings = ( ( (0, 0), (5, 0), (0, 5), (0, 0) ),
|
||||
( (1, 1), (1, 3), (3, 1), (1, 1) ),
|
||||
)
|
||||
rhr_rings = ( ( (0, 0), (0, 5), (5, 0), (0, 0) ),
|
||||
( (1, 1), (3, 1), (1, 3), (1, 1) ),
|
||||
)
|
||||
rings = (
|
||||
((0, 0), (5, 0), (0, 5), (0, 0)),
|
||||
((1, 1), (1, 3), (3, 1), (1, 1)),
|
||||
)
|
||||
rhr_rings = (
|
||||
((0, 0), (0, 5), (5, 0), (0, 0)),
|
||||
((1, 1), (3, 1), (1, 3), (1, 1)),
|
||||
)
|
||||
State.objects.create(name='Foo', poly=Polygon(*rings))
|
||||
s = State.objects.force_rhr().get(name='Foo')
|
||||
self.assertEqual(rhr_rings, s.force_rhr.coords)
|
||||
@@ -648,7 +650,7 @@ class GeoQuerySetTest(TestCase):
|
||||
@no_spatialite
|
||||
def test_reverse_geom(self):
|
||||
"Testing GeoQuerySet.reverse_geom()."
|
||||
coords = [ (-95.363151, 29.763374), (-95.448601, 29.713803) ]
|
||||
coords = [(-95.363151, 29.763374), (-95.448601, 29.713803)]
|
||||
Track.objects.create(name='Foo', line=LineString(coords))
|
||||
t = Track.objects.reverse_geom().get(name='Foo')
|
||||
coords.reverse()
|
||||
|
||||
@@ -31,7 +31,7 @@ def csrf(request):
|
||||
return smart_text(token)
|
||||
_get_val = lazy(_get_val, six.text_type)
|
||||
|
||||
return {'csrf_token': _get_val() }
|
||||
return {'csrf_token': _get_val()}
|
||||
|
||||
def debug(request):
|
||||
"Returns context variables helpful for debugging."
|
||||
|
||||
@@ -32,7 +32,7 @@ def safeRef(target, onDelete = None):
|
||||
if callable(onDelete):
|
||||
return weakref.ref(target, onDelete)
|
||||
else:
|
||||
return weakref.ref( target )
|
||||
return weakref.ref(target)
|
||||
|
||||
class BoundMethodWeakref(object):
|
||||
"""'Safe' and reusable weak references to instance methods
|
||||
@@ -70,7 +70,7 @@ class BoundMethodWeakref(object):
|
||||
|
||||
_allInstances = weakref.WeakValueDictionary()
|
||||
|
||||
def __new__( cls, target, onDelete=None, *arguments,**named ):
|
||||
def __new__(cls, target, onDelete=None, *arguments,**named):
|
||||
"""Create new instance or return current instance
|
||||
|
||||
Basically this method of construction allows us to
|
||||
@@ -85,12 +85,12 @@ class BoundMethodWeakref(object):
|
||||
key = cls.calculateKey(target)
|
||||
current =cls._allInstances.get(key)
|
||||
if current is not None:
|
||||
current.deletionMethods.append( onDelete)
|
||||
current.deletionMethods.append(onDelete)
|
||||
return current
|
||||
else:
|
||||
base = super( BoundMethodWeakref, cls).__new__( cls )
|
||||
base = super(BoundMethodWeakref, cls).__new__(cls)
|
||||
cls._allInstances[key] = base
|
||||
base.__init__( target, onDelete, *arguments,**named)
|
||||
base.__init__(target, onDelete, *arguments,**named)
|
||||
return base
|
||||
|
||||
def __init__(self, target, onDelete=None):
|
||||
@@ -112,13 +112,13 @@ class BoundMethodWeakref(object):
|
||||
methods = self.deletionMethods[:]
|
||||
del self.deletionMethods[:]
|
||||
try:
|
||||
del self.__class__._allInstances[ self.key ]
|
||||
del self.__class__._allInstances[self.key]
|
||||
except KeyError:
|
||||
pass
|
||||
for function in methods:
|
||||
try:
|
||||
if callable( function ):
|
||||
function( self )
|
||||
if callable(function):
|
||||
function(self)
|
||||
except Exception as e:
|
||||
try:
|
||||
traceback.print_exc()
|
||||
@@ -127,20 +127,20 @@ class BoundMethodWeakref(object):
|
||||
self, function, e)
|
||||
)
|
||||
self.deletionMethods = [onDelete]
|
||||
self.key = self.calculateKey( target )
|
||||
self.key = self.calculateKey(target)
|
||||
self.weakSelf = weakref.ref(target.__self__, remove)
|
||||
self.weakFunc = weakref.ref(target.__func__, remove)
|
||||
self.selfName = str(target.__self__)
|
||||
self.funcName = str(target.__func__.__name__)
|
||||
|
||||
def calculateKey( cls, target ):
|
||||
def calculateKey(cls, target):
|
||||
"""Calculate the reference key for this reference
|
||||
|
||||
Currently this is a two-tuple of the id()'s of the
|
||||
target object and the target function respectively.
|
||||
"""
|
||||
return (id(target.__self__),id(target.__func__))
|
||||
calculateKey = classmethod( calculateKey )
|
||||
calculateKey = classmethod(calculateKey)
|
||||
|
||||
def __str__(self):
|
||||
"""Give a friendly representation of the object"""
|
||||
@@ -155,7 +155,7 @@ class BoundMethodWeakref(object):
|
||||
def __hash__(self):
|
||||
return hash(self.key)
|
||||
|
||||
def __bool__( self ):
|
||||
def __bool__(self):
|
||||
"""Whether we are still a valid reference"""
|
||||
return self() is not None
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ class DebugParser(Parser):
|
||||
self.command_stack = []
|
||||
|
||||
def enter_command(self, command, token):
|
||||
self.command_stack.append( (command, token.source) )
|
||||
self.command_stack.append((command, token.source))
|
||||
|
||||
def exit_command(self):
|
||||
self.command_stack.pop()
|
||||
|
||||
@@ -613,10 +613,10 @@ class DocTestParser:
|
||||
self._parse_example(m, name, lineno)
|
||||
# Create an Example, and add it to the list.
|
||||
if not self._IS_BLANK_OR_COMMENT(source):
|
||||
output.append( Example(source, want, exc_msg,
|
||||
output.append(Example(source, want, exc_msg,
|
||||
lineno=lineno,
|
||||
indent=min_indent+len(m.group('indent')),
|
||||
options=options) )
|
||||
options=options))
|
||||
# Update lineno (lines inside this example)
|
||||
lineno += string.count('\n', m.start(), m.end())
|
||||
# Update charno.
|
||||
@@ -1498,7 +1498,7 @@ class DocTestRunner:
|
||||
if t == 0:
|
||||
notests.append(name)
|
||||
elif f == 0:
|
||||
passed.append( (name, t) )
|
||||
passed.append((name, t))
|
||||
else:
|
||||
failed.append(x)
|
||||
if verbose:
|
||||
|
||||
@@ -92,42 +92,42 @@ PALETTES = {
|
||||
'MIGRATE_FAILURE': {},
|
||||
},
|
||||
DARK_PALETTE: {
|
||||
'ERROR': { 'fg': 'red', 'opts': ('bold',) },
|
||||
'NOTICE': { 'fg': 'red' },
|
||||
'SQL_FIELD': { 'fg': 'green', 'opts': ('bold',) },
|
||||
'SQL_COLTYPE': { 'fg': 'green' },
|
||||
'SQL_KEYWORD': { 'fg': 'yellow' },
|
||||
'SQL_TABLE': { 'opts': ('bold',) },
|
||||
'HTTP_INFO': { 'opts': ('bold',) },
|
||||
'HTTP_SUCCESS': { },
|
||||
'HTTP_REDIRECT': { 'fg': 'green' },
|
||||
'HTTP_NOT_MODIFIED': { 'fg': 'cyan' },
|
||||
'HTTP_BAD_REQUEST': { 'fg': 'red', 'opts': ('bold',) },
|
||||
'HTTP_NOT_FOUND': { 'fg': 'yellow' },
|
||||
'HTTP_SERVER_ERROR': { 'fg': 'magenta', 'opts': ('bold',) },
|
||||
'MIGRATE_HEADING': { 'fg': 'cyan', 'opts': ('bold',) },
|
||||
'MIGRATE_LABEL': { 'opts': ('bold',) },
|
||||
'MIGRATE_SUCCESS': { 'fg': 'green', 'opts': ('bold',) },
|
||||
'MIGRATE_FAILURE': { 'fg': 'red', 'opts': ('bold',) },
|
||||
'ERROR': {'fg': 'red', 'opts': ('bold',)},
|
||||
'NOTICE': {'fg': 'red'},
|
||||
'SQL_FIELD': {'fg': 'green', 'opts': ('bold',)},
|
||||
'SQL_COLTYPE': {'fg': 'green'},
|
||||
'SQL_KEYWORD': {'fg': 'yellow'},
|
||||
'SQL_TABLE': {'opts': ('bold',)},
|
||||
'HTTP_INFO': {'opts': ('bold',)},
|
||||
'HTTP_SUCCESS': {},
|
||||
'HTTP_REDIRECT': {'fg': 'green'},
|
||||
'HTTP_NOT_MODIFIED': {'fg': 'cyan'},
|
||||
'HTTP_BAD_REQUEST': {'fg': 'red', 'opts': ('bold',)},
|
||||
'HTTP_NOT_FOUND': {'fg': 'yellow'},
|
||||
'HTTP_SERVER_ERROR': {'fg': 'magenta', 'opts': ('bold',)},
|
||||
'MIGRATE_HEADING': {'fg': 'cyan', 'opts': ('bold',)},
|
||||
'MIGRATE_LABEL': {'opts': ('bold',)},
|
||||
'MIGRATE_SUCCESS': {'fg': 'green', 'opts': ('bold',)},
|
||||
'MIGRATE_FAILURE': {'fg': 'red', 'opts': ('bold',)},
|
||||
},
|
||||
LIGHT_PALETTE: {
|
||||
'ERROR': { 'fg': 'red', 'opts': ('bold',) },
|
||||
'NOTICE': { 'fg': 'red' },
|
||||
'SQL_FIELD': { 'fg': 'green', 'opts': ('bold',) },
|
||||
'SQL_COLTYPE': { 'fg': 'green' },
|
||||
'SQL_KEYWORD': { 'fg': 'blue' },
|
||||
'SQL_TABLE': { 'opts': ('bold',) },
|
||||
'HTTP_INFO': { 'opts': ('bold',) },
|
||||
'HTTP_SUCCESS': { },
|
||||
'HTTP_REDIRECT': { 'fg': 'green', 'opts': ('bold',) },
|
||||
'HTTP_NOT_MODIFIED': { 'fg': 'green' },
|
||||
'HTTP_BAD_REQUEST': { 'fg': 'red', 'opts': ('bold',) },
|
||||
'HTTP_NOT_FOUND': { 'fg': 'red' },
|
||||
'HTTP_SERVER_ERROR': { 'fg': 'magenta', 'opts': ('bold',) },
|
||||
'MIGRATE_HEADING': { 'fg': 'cyan', 'opts': ('bold',) },
|
||||
'MIGRATE_LABEL': { 'opts': ('bold',) },
|
||||
'MIGRATE_SUCCESS': { 'fg': 'green', 'opts': ('bold',) },
|
||||
'MIGRATE_FAILURE': { 'fg': 'red', 'opts': ('bold',) },
|
||||
'ERROR': {'fg': 'red', 'opts': ('bold',)},
|
||||
'NOTICE': {'fg': 'red'},
|
||||
'SQL_FIELD': {'fg': 'green', 'opts': ('bold',)},
|
||||
'SQL_COLTYPE': {'fg': 'green'},
|
||||
'SQL_KEYWORD': {'fg': 'blue'},
|
||||
'SQL_TABLE': {'opts': ('bold',)},
|
||||
'HTTP_INFO': {'opts': ('bold',)},
|
||||
'HTTP_SUCCESS': {},
|
||||
'HTTP_REDIRECT': {'fg': 'green', 'opts': ('bold',)},
|
||||
'HTTP_NOT_MODIFIED': {'fg': 'green'},
|
||||
'HTTP_BAD_REQUEST': {'fg': 'red', 'opts': ('bold',)},
|
||||
'HTTP_NOT_FOUND': {'fg': 'red'},
|
||||
'HTTP_SERVER_ERROR': {'fg': 'magenta', 'opts': ('bold',)},
|
||||
'MIGRATE_HEADING': {'fg': 'cyan', 'opts': ('bold',)},
|
||||
'MIGRATE_LABEL': {'opts': ('bold',)},
|
||||
'MIGRATE_SUCCESS': {'fg': 'green', 'opts': ('bold',)},
|
||||
'MIGRATE_FAILURE': {'fg': 'red', 'opts': ('bold',)},
|
||||
}
|
||||
}
|
||||
DEFAULT_PALETTE = DARK_PALETTE
|
||||
|
||||
@@ -343,7 +343,7 @@ class ExceptionReporter(object):
|
||||
before = escape(template_source[upto:start])
|
||||
during = escape(template_source[start:end])
|
||||
after = escape(template_source[end:next])
|
||||
source_lines.append( (num, escape(template_source[upto:next])) )
|
||||
source_lines.append((num, escape(template_source[upto:next])))
|
||||
upto = next
|
||||
total = len(source_lines)
|
||||
|
||||
@@ -450,7 +450,7 @@ class ExceptionReporter(object):
|
||||
"""
|
||||
import traceback
|
||||
frames = self.get_traceback_frames()
|
||||
tb = [ (f['filename'], f['lineno'], f['function'], f['context_line']) for f in frames ]
|
||||
tb = [(f['filename'], f['lineno'], f['function'], f['context_line']) for f in frames]
|
||||
list = ['Traceback (most recent call last):\n']
|
||||
list += traceback.format_list(tb)
|
||||
list += traceback.format_exception_only(self.exc_type, self.exc_value)
|
||||
|
||||
Reference in New Issue
Block a user