Guest User

Untitled

a guest
Jan 13th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. import ZODB.DB
  2. import ZODB.FileStorage
  3.  
  4. filename = 'var/filestorage/Data.fs'
  5. foldername = 'news-'
  6. savepath = 'news_pexego/'
  7.  
  8. storage = ZODB.FileStorage.FileStorage(filename, read_only=1)
  9.  
  10. DB = ZODB.DB(storage)
  11. conn = DB.open()
  12.  
  13. root = conn.root()['Application']
  14. site = root['pexego.es']
  15. folder = site['news-']
  16.  
  17. for item in news.items():
  18. ATitem = item[1]
  19. exported_file = open(savepath+item[0]+'.txt', 'w')
  20. exported_content = """
  21. Titulo: %s
  22.  
  23. -------------------------------------
  24.  
  25. Resumen:
  26.  
  27. %s
  28.  
  29. -------------------------------------
  30.  
  31. Cuerpo:
  32.  
  33. %s
  34.  
  35. -------------------------------------
  36. """ % (ATitem.title, ATitem.Description, ATitem.getText())
  37.  
  38. # Rest of the code goes here (Still working on that, but it just put the
  39. # contents into the file and closes it)
Add Comment
Please, Sign In to add comment