Skip to content

Instantly share code, notes, and snippets.

@tschanzt
Last active August 29, 2015 13:57
Show Gist options
  • Select an option

  • Save tschanzt/9832267 to your computer and use it in GitHub Desktop.

Select an option

Save tschanzt/9832267 to your computer and use it in GitHub Desktop.
edbs-script
from DateTime import DateTime
cat = context.portal_catalog
results = cat({'query': {'path':'/www.ed.bs.ch/platform/veranstaltungskalender', 'depth':0}, 'portal_type':'FtwEvent', 'start': {'query':DateTime("2013-12-31"), 'range':'max'}})
folder = context.restrictedTraverse('/www.ed.bs.ch/platform/veranstaltungskalender')
ids_to_delete = []
for item in results:
if item.end and item.end.year >= 2014:
continue
obj=item.getObject()
if not obj.frequency or obj.frequency == -1:
ids_to_delete.append(obj.id)
print ids_to_delete
return printed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment