Skip to content. | Skip to navigation

Sections
Personal tools
What is this?
Hi, my name is Tom Lazar and I'm a Plone and Zope developer based in Berlin, Germany and this is my personal and professional (no big difference, really...) website.
 

Unexpiring content

Filed Under:

Others got SQL. We've got the catalog.

Here's a quick snippet for quickly un-expiring content from a ./bin/instance debug session:

plone_site = app.foo
from transaction import commit
import DateTime
now = DateTime.now()
for brain in plone_site.portal_catalog({
    'expires' : {'query' : now, 'range' : 'max'}}):

    obj = brain.getObject()
    obj.setExpirationDate(now + 30)
    obj.reindexObject()

commit()

This sets the expiration date of all currently expired objects 30 days into the future. (You'll need to change app.foo to the id of your plone instance, of course.)