the fieldmapping transformer methods should return transformed data, rather than manipulating their arguments

Bug #416963 reported by Eric Casteleijn on 2009-08-21
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
desktopcouch
Medium
Eric Casteleijn
desktopcouch (Ubuntu)
Medium
Eric Casteleijn

Bug Description

These two methods in field_registry.py should return results, rather than modify their second argument.

    def from_app(self, data, record):
        """Transform from application data to record data."""
        for key, val in data.items():
            if key in self.field_registry:
                self.field_registry[key].setValue(record, val)
            else:
                record.application_annotations.setdefault(
                    self.app_name, {}).setdefault(
                    'application_fields', {})[key] = val

    def to_app(self, record, data):
        """Transform from record data to application data."""
        annotations = record.application_annotations.get(self.app_name, {}).get(
            'application_fields', {})
        for key, value in annotations.items():
            data[key] = value
        for key in self.field_registry:
            data[key] = self.field_registry[key].getValue(record)

Related branches

Changed in desktopcouch:
milestone: none → 0.6
Changed in desktopcouch:
milestone: 0.6 → 1.0
Changed in desktopcouch:
status: Triaged → In Progress
Changed in desktopcouch:
status: In Progress → Fix Committed
Changed in desktopcouch (Ubuntu):
status: New → In Progress
importance: Undecided → Medium
assignee: nobody → Eric Casteleijn (thisfred)
milestone: none → natty-alpha-1
Changed in desktopcouch (Ubuntu):
milestone: natty-alpha-1 → natty-alpha-2
Changed in desktopcouch:
status: Fix Committed → Fix Released
Changed in desktopcouch (Ubuntu):
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers