Permalink
Browse files

[py3] Fixed admin_views tests

Also changed several occurrences of 'request' to 'response'.
  • Loading branch information...
1 parent d6b8b12 commit c2d59e556499ecee3d8a1fc684f49a21463ab1c1 @claudep claudep committed Aug 14, 2012
@@ -17,7 +17,7 @@ def render(self, context):
user_id = self.user
if not user_id.isdigit():
user_id = context[self.user].id
- context[self.varname] = LogEntry.objects.filter(user__id__exact=user_id).select_related('content_type', 'user')[:self.limit]
+ context[self.varname] = LogEntry.objects.filter(user__id__exact=user_id).select_related('content_type', 'user')[:int(self.limit)]
return ''
@register.tag
@@ -148,7 +148,7 @@ def get_query_string(self, new_params=None, remove=None):
if remove is None: remove = []
p = self.params.copy()
for r in remove:
- for k in p.keys():
+ for k in list(p.keys()):
if k.startswith(r):
del p[k]
for k, v in new_params.items():
@@ -855,7 +855,7 @@ def unique_error_message(self, model_class, unique_check):
}
# unique_together
else:
- field_labels = map(lambda f: capfirst(opts.get_field(f).verbose_name), unique_check)
+ field_labels = [capfirst(opts.get_field(f).verbose_name) for f in unique_check]
field_labels = get_text_list(field_labels, _('and'))
return _("%(model_name)s with this %(field_label)s already exists.") % {
'model_name': six.text_type(model_name),
@@ -66,7 +66,7 @@ def dictvalue(t):
# max-age, use the minimum of the two ages. In practice this happens when
# a decorator and a piece of middleware both operate on a given view.
if 'max-age' in cc and 'max_age' in kwargs:
- kwargs['max_age'] = min(cc['max-age'], kwargs['max_age'])
+ kwargs['max_age'] = min(int(cc['max-age']), kwargs['max_age'])
# Allow overriding private caching and vice versa
if 'private' in cc and 'public' in kwargs:
@@ -287,7 +287,7 @@ def compress_string(s):
def javascript_quote(s, quote_double_quotes=False):
def fix(match):
- return b"\u%04x" % ord(match.group(1))
+ return "\\u%04x" % ord(match.group(1))
if type(s) == bytes:
s = s.decode('utf-8')
Oops, something went wrong.

0 comments on commit c2d59e5

Please sign in to comment.