1
0
mirror of https://github.com/django/django.git synced 2025-06-05 03:29:12 +00:00

magic-removal: Got rid of django.utils.datastructures.dot_expand, which wasn't being used

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2105 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2006-01-22 06:51:35 +00:00
parent 63b158ecb4
commit 17ece1adb8
2 changed files with 1 additions and 17 deletions

View File

@ -5,7 +5,7 @@ from django.db.models.exceptions import BadCommand
from django.dispatch import dispatcher from django.dispatch import dispatcher
from django.db.models import signals from django.db.models import signals
from django.utils.functional import curry from django.utils.functional import curry
from django.utils.datastructures import dot_expand, MultiValueDict from django.utils.datastructures import DotExpandedDict, MultiValueDict
import types import types
def add_manipulators(sender): def add_manipulators(sender):
@ -79,7 +79,6 @@ class AutomaticManipulator(forms.Manipulator):
def save(self, new_data): def save(self, new_data):
# TODO: big cleanup when core fields go -> use recursive manipulators. # TODO: big cleanup when core fields go -> use recursive manipulators.
from django.utils.datastructures import DotExpandedDict
params = {} params = {}
for f in self.opts.fields: for f in self.opts.fields:
# Fields with auto_now_add should keep their original value in the change stage. # Fields with auto_now_add should keep their original value in the change stage.

View File

@ -224,18 +224,3 @@ class DotExpandedDict(dict):
current[bits[-1]] = v current[bits[-1]] = v
except TypeError: # Special-case if current isn't a dict. except TypeError: # Special-case if current isn't a dict.
current = {bits[-1] : v} current = {bits[-1] : v}
def dot_expand(key_to_list_mapping, dict_factory=dict):
top = dict_factory()
for k, v in key_to_list_mapping.items():
current = top
bits = k.split('.')
for bit in bits[:-1]:
current = current.setdefault(bit, dict_factory())
# Now assign value to current position
try:
current[bits[-1]] = v
except TypeError: # Special-case if current isn't a dict.
current = dict_factory( (bits[-1], v) )
return top