kopia lustrzana https://gitlab.com/marnanel/chapeau
Thing fields named f_* have content correctly parsed as JSON.
Thing.entomb() had rotted; fixed. Debug print removed.2019-08-17
rodzic
270e55b1af
commit
fc3f213757
|
@ -157,7 +157,7 @@ class Thing(PolymorphicModel):
|
||||||
if value=='':
|
if value=='':
|
||||||
value = None
|
value = None
|
||||||
|
|
||||||
result[name[2:]] = value
|
result[name[2:]] = json.loads(value)
|
||||||
|
|
||||||
if self.other_fields:
|
if self.other_fields:
|
||||||
result.update(json.loads(self.other_fields))
|
result.update(json.loads(self.other_fields))
|
||||||
|
@ -280,8 +280,7 @@ class Thing(PolymorphicModel):
|
||||||
|
|
||||||
if result==False:
|
if result==False:
|
||||||
logger.debug(' -- deleting original object')
|
logger.debug(' -- deleting original object')
|
||||||
logger.info(' --> This is %s %s',
|
|
||||||
self, self.thing_ptr_id)
|
|
||||||
try:
|
try:
|
||||||
self.delete()
|
self.delete()
|
||||||
except AssertionError:
|
except AssertionError:
|
||||||
|
@ -309,21 +308,12 @@ class Thing(PolymorphicModel):
|
||||||
raise ValueError("%s: you can't entomb remote things %s",
|
raise ValueError("%s: you can't entomb remote things %s",
|
||||||
self, str(self.remote_url))
|
self, str(self.remote_url))
|
||||||
|
|
||||||
former_type = self.f_type
|
self['type'] = 'Tombstone'
|
||||||
|
self['deleted'] = datetime.datetime.now()
|
||||||
self.f_type = 'Tombstone'
|
|
||||||
self.active = True
|
self.active = True
|
||||||
|
|
||||||
ThingField.objects.filter(parent=self).delete()
|
|
||||||
|
|
||||||
for f,v in [
|
|
||||||
('former_type', former_type),
|
|
||||||
# XXX 'deleted', when we're doing timestamps
|
|
||||||
]:
|
|
||||||
ThingField(parent=self, name=f, value=json.dumps(v)).save()
|
|
||||||
|
|
||||||
self.save()
|
self.save()
|
||||||
logger.info('%s: entombing finished', self)
|
logger.info('%s: entombed', self)
|
||||||
|
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue