Skip to content

Commit

Permalink
WCM-167: let the publication options handle the list of unique ids
Browse files Browse the repository at this point in the history
  • Loading branch information
stollero committed Jan 8, 2025
1 parent d8bedd9 commit 0fde11e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
6 changes: 5 additions & 1 deletion core/src/zeit/cms/workflow/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def publish_content(options: dict):
options.ignore_services.split(',') + IGNORE_SERVICES
)

for uid in options.unique_ids.split('\n'):
for uid in options.unique_ids:
content = zeit.cms.interfaces.ICMSContent(uid, None)
if content is None:
log.warn('Skipping %s, not found', uid)
Expand Down Expand Up @@ -134,6 +134,10 @@ def publish():
raise SystemExit(1)

to_publish = open(options.filename).read()
# we need to match the properties of IManualPublicationOptions
# ideally we would use the interface directly,
# but we need to pass the options to the celery task
# means another roundtrip of serialization and deserialization
options = options.__dict__
options['unique_ids'] = to_publish

Expand Down
16 changes: 15 additions & 1 deletion core/src/zeit/cms/workflow/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,24 @@

@grok.implementer(IManualPublicationOptions)
class PublicationOptions:
_unique_ids = ''

@property
def unique_ids(self):
return self._unique_ids.split('\n')

@unique_ids.setter
def unique_ids(self, value):
self._unique_ids = value

@classmethod
def from_dict(cls, options):
obj = cls()
obj.__dict__.update(options)
for key, value in options.items():
if key == 'unique_ids':
obj.unique_ids = value
else:
setattr(obj, key, value)
return obj


Expand Down

0 comments on commit 0fde11e

Please sign in to comment.