暫無描述
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 826B

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