~ubuntu-branches/ubuntu/quantal/python-django/quantal-security

« back to all changes in this revision

Viewing changes to django/test/utils.py

  • Committer: Bazaar Package Importer
  • Author(s): Jamie Strandboge
  • Date: 2010-10-12 11:34:35 UTC
  • mfrom: (4.4.9 sid)
  • mto: This revision was merged to the branch mainline in revision 30.
  • Revision ID: james.westby@ubuntu.com-20101012113435-5rk3p18nyanuhj6g
* SECURITY UPDATE: XSS in CSRF protections. New upstream release
  - CVE-2010-3082
* debian/patches/01_disable_url_verify_regression_tests.diff:
  - updated to disable another test that fails without internet connection
  - patch based on work by Kai Kasurinen and Krzysztof Klimonda
* debian/control: don't Build-Depends on locales-all, which doesn't exist
  in maverick

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
import sys, time, os
 
1
import sys
 
2
import time
 
3
import os
2
4
from django.conf import settings
3
5
from django.core import mail
4
6
from django.core.mail.backends import locmem
6
8
from django.template import Template
7
9
from django.utils.translation import deactivate
8
10
 
 
11
 
 
12
class Approximate(object):
 
13
    def __init__(self, val, places=7):
 
14
        self.val = val
 
15
        self.places = places
 
16
 
 
17
    def __repr__(self):
 
18
        return repr(self.val)
 
19
 
 
20
    def __eq__(self, other):
 
21
        if self.val == other:
 
22
            return True
 
23
        return round(abs(self.val-other), self.places) == 0
 
24
 
 
25
 
9
26
class ContextList(list):
10
27
    """A wrapper that provides direct key access to context items contained
11
28
    in a list of context objects.