No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

make.py 1.3 KiB

hace 13 años
hace 13 años
hace 13 años
hace 13 años
hace 13 años
hace 13 años
hace 13 años
hace 13 años
hace 13 años
hace 13 años
hace 13 años
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. """
  2. make index, wn.js, wn.css pages
  3. - rebuild all pages on change of website settings (toolbar)
  4. """
  5. def make():
  6. import os
  7. import webnotes
  8. from jinja2 import Template
  9. import webnotes.cms
  10. if not webnotes.conn:
  11. webnotes.connect()
  12. make_web_core()
  13. def make_web_core():
  14. """make index.html, wn-web.js, wn-web.css, sitemap.xml and rss.xml"""
  15. # index.html
  16. from webnotes.model.code import get_obj
  17. import webnotes
  18. home_page = webnotes.cms.get_home_page('Guest')
  19. get_obj('Page', home_page).write_cms_page()
  20. # js/wn-web.js and css/wn-web.css
  21. write_web_js_css(home_page)
  22. # sitemap.xml
  23. # rss.xml
  24. def write_web_js_css(home_page):
  25. """write web js and css"""
  26. # script - wn.js
  27. import os
  28. import startup.event_handlers
  29. fname = 'js/wn-web.js'
  30. if os.path.basename(os.path.abspath('.'))!='public':
  31. fname = os.path.join('public', fname)
  32. if hasattr(startup.event_handlers, 'get_web_script'):
  33. with open(fname, 'w') as f:
  34. script = 'window.home_page = "%s";\n' % home_page
  35. script += startup.event_handlers.get_web_script()
  36. f.write(script)
  37. fname = 'css/wn-web.css'
  38. if os.path.basename(os.path.abspath('.'))!='public':
  39. fname = os.path.join('public', fname)
  40. # style - wn.css
  41. if hasattr(startup.event_handlers, 'get_web_style'):
  42. with open(fname, 'w') as f:
  43. f.write(startup.event_handlers.get_web_style())