From fcec755f01cfaba2a85bfc9511876debbce98631 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Fri, 17 Aug 2007 15:05:54 +0000 Subject: newforms-admin: Merged from trunk up to [5916] git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@5918 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/utils/datastructures.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'django/utils/datastructures.py') diff --git a/django/utils/datastructures.py b/django/utils/datastructures.py index 60bc0051a2..4b60d1d194 100644 --- a/django/utils/datastructures.py +++ b/django/utils/datastructures.py @@ -267,3 +267,16 @@ class DotExpandedDict(dict): current[bits[-1]] = v except TypeError: # Special-case if current isn't a dict. current = {bits[-1] : v} + +class FileDict(dict): + """ + A dictionary used to hold uploaded file contents. The only special feature + here is that repr() of this object won't dump the entire contents of the + file to the output. A handy safeguard for a large file upload. + """ + def __repr__(self): + if 'content' in self: + d = dict(self, content='') + return dict.__repr__(d) + return dict.__repr__(self) + -- cgit v1.3