No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

utils.py 874B

1234567891011121314151617181920212223242526272829
  1. # -*- coding: utf-8 -*-
  2. import settings
  3. from settings import *
  4. from loader import *
  5. def refreshdyn():
  6. import sys
  7. from EditorialModel.model import Model
  8. from leapi.lefactory import LeFactory
  9. from EditorialModel.backend.json_backend import EmBackendJson
  10. from DataSource.MySQL.leapidatasource import LeDataSourceSQL
  11. OUTPUT = dynamic_code
  12. EMJSON = emfile
  13. # Load editorial model
  14. em = Model(EmBackendJson(EMJSON))
  15. # Generate dynamic code
  16. fact = LeFactory(OUTPUT)
  17. # Create the python file
  18. fact.create_pyfile(em, LeDataSourceSQL, {})
  19. def db_init():
  20. from EditorialModel.backend.json_backend import EmBackendJson
  21. from EditorialModel.model import Model
  22. mh = getattr(migrationhandler,settings.mh_classname)(**(settings.datasource['default']))
  23. em = Model(EmBackendJson(settings.emfile))
  24. em.migrate_handler(mh)