◄ ► | Edit | Home | Admin | en de fr et | Sign in

#4282 (restore.py fails to restore SiteConfig)

by Luc Saffre · in Developers · assigned to Luc Saffre

Summary

Abandoning with 1 unsaved instances:

- system.SiteConfig {'id': ['Site configuration with this ID already exists.']} (1 object(s) with primary key 1)


Children

Comments

  • 4 years, 2 months ago by Luc Saffre about #4282 (restore.py fails to restore SiteConfig) : Seems that I fixed it. get_site_config() was saving the instance too quickly. And SiteConfig.save() now always overrides the cached instance. But before committing I will run the whole test suite.
  • 4 years, 2 months ago by Luc Saffre about #4282 (restore.py fails to restore SiteConfig) : Ha! I can reproduce it! go amici1; pm dump2py tmp; pm run tmp/restore.py
  • 4 years, 2 months ago by Luc Saffre in reply to Luc Saffre about #4282 (restore.py fails to restore SiteConfig) : The snapshot/system_siteconfig.py file says:
    loader.save(create_system_siteconfig(1,None,None,None,5282,None,None,72,None,'Blue',None))
    lino.utils.dpy.DpyLoader.save() actually returns a FakeDeserializedObjkect wrapper, but that's not the rease. I guess that it is because the loader calls full_clea...
  • 4 years, 2 months ago by Luc Saffre about #4282 (restore.py fails to restore SiteConfig) (1 reply) : It doesn't yet work (for #4623 I still had to restore manually) because restore.py said Abandoning with 1 unsaved instances: - system.SiteConfig {'id': ['Site configuration with this ID already exists.']} (1 object(s) with primary key 1)
  • 4 years, 2 months ago by Luc Saffre about #4282 (restore.py fails to restore SiteConfig) : I didn't understand why I cannot reproduce it locally. But I moved the code that caches the SiteConfig instance from lino.core.site to the SiteConfig model and optimized the save() method so that when restore.py tries to save a second instance, it actually updates the singleton.
  • 4 years, 2 months ago by Luc Saffre in reply to Luc Saffre about #4282 (restore.py fails to restore SiteConfig) : No, it's not reproducible e.g. in min2.
  • 5 years, 2 months ago by Luc Saffre about #4282 (restore.py fails to restore SiteConfig) : A workaround is to edit the restore.py file and replace the last line of the create_system_siteconfig() function by::
       settings.SITE.site_config.update(**kw)   # return system_SiteConfig(**kw)
  • 5 years, 2 months ago by Luc Saffre about #4282 (restore.py fails to restore SiteConfig) (1 reply) : IOW it should be reproducible on any demo project by doing "pm dump2py tmp" followed by "pm run tmp/restore.py". We should add a test case for this, since obviously this wasn't covered.
  • 5 years, 2 months ago by Luc Saffre about #4282 (restore.py fails to restore SiteConfig) : Do you remember when we recently removed SiteConfigManager because it seemed useless? And I said "Don't fully remove it, just deactivate it with an if statement? Now we have an example why it was needed: for the restore.py script.