20130209¶
UI-less Lino¶
Started https://www.lino-framework.org/tutorials/uiless.html.
The following problem took me some time. Restoring the dumped fixture in our example failed with:
WARNING Abandoning with 24 unsaved instances from fixtures\a.py:
- auth.Permission {'id': [u'Permission with this ID already exists.'], '__all__': [u'Permission with this Content type and Codename already exists.']} (24 object(s) with primary key 16, 17, 18, 1, 4, 7, 2, 5, 8, 3, 6, 9, 10, 11, 12, 19, 21, 23, 20, 22, 24, 13, 14, 15)
That’s because these permission instances are being automatically created by django.contrib.auth.management.create_permissions before the dumpy deserializer could restore them. create_permissions is being invoked by the post_sync signal. The problem is that initdb should not emit this post_sync signal at all.
I didn’t find a less cruel method to solve this than amputating Django’s post_syncdb signal:
class NullSignal:
def connect(*args,**kw):
pass
def send(*args,**kw):
pass
models.signals.post_syncdb = NullSignal()
This is done by the new –dumped option of loaddata.
But the story goes on in https://www.lino-framework.org0211.html.