kopia lustrzana https://gitlab.com/marnanel/chapeau
create() stops policing whether new objects do or don't have an "id"
field, based on their is_local status. The views should be doing that, anyway.trilby
rodzic
1cec285208
commit
f869198108
|
@ -86,15 +86,6 @@ def create(
|
||||||
str(k))
|
str(k))
|
||||||
del value[k]
|
del value[k]
|
||||||
|
|
||||||
if 'id' in value:
|
|
||||||
if is_local_user:
|
|
||||||
logger.warn('Removing "id" field at local Object creation')
|
|
||||||
del value['id']
|
|
||||||
else:
|
|
||||||
if not is_local_user:
|
|
||||||
logger.warn("Remote Objects must have an id; dropping message")
|
|
||||||
return None
|
|
||||||
|
|
||||||
class_name = 'Ac'+value['type']
|
class_name = 'Ac'+value['type']
|
||||||
try:
|
try:
|
||||||
import django_kepi.models as kepi_models
|
import django_kepi.models as kepi_models
|
||||||
|
@ -132,7 +123,7 @@ def create(
|
||||||
id = value['id'],
|
id = value['id'],
|
||||||
)
|
)
|
||||||
result.save()
|
result.save()
|
||||||
logger.info(' -- created local copy of remote object %s ',
|
logger.info(' -- created object %s',
|
||||||
result)
|
result)
|
||||||
del value['id']
|
del value['id']
|
||||||
except django.db.utils.IntegrityError:
|
except django.db.utils.IntegrityError:
|
||||||
|
@ -143,7 +134,7 @@ def create(
|
||||||
result = cls(
|
result = cls(
|
||||||
)
|
)
|
||||||
result.save()
|
result.save()
|
||||||
logger.warn(' -- created local object %s',
|
logger.warn(' -- created object %s',
|
||||||
result)
|
result)
|
||||||
|
|
||||||
for f,v in value.items():
|
for f,v in value.items():
|
||||||
|
|
Ładowanie…
Reference in New Issue