Stephen Z. Fadem, M. D.

10/31/2004

How to archive newsdesk pages

Filed under: — fadem @ 4:54 pm

… by Brian Rosenthal

I implemented an “archive” method, which can be called from any DTML Document (or any other object, for that matter, but not for a method).
Let’s say we want to archive the DTML Document “news_dtml”
We call “(Link:http://links.nephron.com/news_dtml/archive)http://links.nephron.com/news_dtml/archive", which does the
following:
A. CREATE A FOLDER “news_dtml_archive” if it does not already exist.
B. CREATE A METHOD inside the folder called “index_html” which lists
all Documents inside the folder.
C. CREATE A DOCUMENT “2004_11_01″ titled “TITLE - 2004-11-01″ (or
equivalent) which contains in its body the result of calling the method.
n that way, any time you call the “archive” method on an object, it
will create a folder to manage the archives and start populating it.
Now, you have to actually hit that page
“(Link: http://links.nephron.com/news_dtml/archive)http://links.nephron.com/news_dtml/archive” to get this to work. It doesn’t make sense to call “archive” from within the document because you wouldn’t know whether the document was finished (not to mention the
loop: document calls archive, which calls document, which calls archive…).
Therefore, to get the archive script to be called regularly, we have to schedule a task to hit the page
“(Link: http://links.nephron.com/news_dtml/archive)http://links.nephron.com/news_dtml/archive” (or whatever you want to archive) on regular basis (probably at 10 PM at night).
Zope does not to my knowledge have a scheduling infrastructure, so we will use the “crontab” infrastructure on the UNIX machine (same as the
auto-execute).
I have set it to auto-execute every evening at 10 PM California Time (midnight CST) for news_dtml and I can add as many as you’d like to that
file.Alternatively, you can take a look at the script that runs. It is located here: /home/brosenth/crontab/nd_nightly.sh

Powered by WordPress