gwu-libraries / sfm-ui

Social Feed Manager user interface application.
http://gwu-libraries.github.io/sfm-ui
MIT License
153 stars 25 forks source link

Write README.txt also for collections set with no collections #1101

Open sebastian-nagel opened 2 years ago

sebastian-nagel commented 2 years ago

Prevent serialize_all from failing on an empty collection set when writing the README.txt:

INFO 2022-03-04 03:00:54,182 63 ui.serialize Serializing <Collection Set 72 "...">
ERROR 2022-03-04 03:00:54,186 63 apscheduler.executors.default Job "serialize_all (trigger: cron[hour='3', minute='0'], next run at: 2022-03-05 03:00:00 UTC)" raised an exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/apscheduler/executors/base.py", line 125, in run_job
    retval = job.func(*job.args, **job.kwargs)
  File "/opt/sfm-ui/sfm/ui/serialize.py", line 550, in serialize_all
    serializer.serialize_all()
  File "/opt/sfm-ui/sfm/ui/serialize.py", line 50, in serialize_all
    self.serialize_collection_set(collection_set, force_serialize=force_serialize)
  File "/opt/sfm-ui/sfm/ui/serialize.py", line 59, in serialize_collection_set
    get_collection_set_path(collection_set, sfm_data_dir=self.data_dir))
  File "/opt/sfm-ui/sfm/ui/serialize.py", line 271, in _write_readme
    with codecs.open(readme_filepath, "w", encoding="utf-8") as f:
  File "/usr/local/lib/python3.6/codecs.py", line 897, in open
    file = builtins.open(filename, mode, buffering)
No such file or directory: '/sfm-data/collection_set/aa0cbd1e5c374c0a9c67cf2ce45caf9b/README.txt'