Commit 7d4e72c1 authored by Brian May's avatar Brian May

Convert from git-dpm to patches unapplied format

parent a83250de
# see git-dpm(1) from git-dpm package
777393fbb8b0684d2a5fe1095c4ff98965eb1238
777393fbb8b0684d2a5fe1095c4ff98965eb1238
3896a3775fa50d001bf7fe4104550e3055fb2cc0
3896a3775fa50d001bf7fe4104550e3055fb2cc0
django-model-utils_2.5.2.orig.tar.gz
d441ebadb9f6594fe5c385fa516bad022d604a61
41124
debianTag="debian/%e%v"
patchedTag="patched/%e%v"
upstreamTag="upstream/%e%u"
[DEFAULT]
debian-branch=debian/master
......@@ -2,9 +2,8 @@ from __future__ import unicode_literals
from copy import deepcopy
import django
from django.core.exceptions import FieldError
from django.db import models
from django.core.exceptions import FieldError
from django.db.models.query_utils import DeferredAttribute
......@@ -63,14 +62,12 @@ class FieldInstanceTracker(object):
)
def init_deferred_fields(self):
self.instance._deferred_fields = set()
self.instance._deferred_fields = []
if hasattr(self.instance, '_deferred') and not self.instance._deferred:
return
class DeferredAttributeTracker(DeferredAttribute):
def __get__(field, instance, owner):
if instance is None:
return field
data = instance.__dict__
if data.get(field.field_name, field) is field:
instance._deferred_fields.remove(field.field_name)
......@@ -79,31 +76,19 @@ class FieldInstanceTracker(object):
self.saved_data[field.field_name] = deepcopy(value)
return data[field.field_name]
if django.VERSION >= (1, 8):
self.instance._deferred_fields = self.instance.get_deferred_fields()
for field in self.instance._deferred_fields:
if django.VERSION >= (1, 10):
field_obj = getattr(self.instance.__class__, field)
else:
field_obj = self.instance.__class__.__dict__.get(field)
for field in self.fields:
field_obj = self.instance.__class__.__dict__.get(field)
if isinstance(field_obj, DeferredAttribute):
self.instance._deferred_fields.append(field)
# Django 1.4
model = None
if hasattr(field_obj, 'model_ref'):
model = field_obj.model_ref()
field_tracker = DeferredAttributeTracker(
field_obj.field_name, None)
field_obj.field_name, model)
setattr(self.instance.__class__, field, field_tracker)
else:
for field in self.fields:
field_obj = self.instance.__class__.__dict__.get(field)
if isinstance(field_obj, DeferredAttribute):
self.instance._deferred_fields.add(field)
# Django 1.4
if django.VERSION >= (1, 5):
model = None
else:
model = field_obj.model_ref()
field_tracker = DeferredAttributeTracker(
field_obj.field_name, model)
setattr(self.instance.__class__, field, field_tracker)
class FieldTracker(object):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment