On Tue, Feb 01, 2005 at 09:51:12AM +0100, Frank Scholz wrote:
> ent = container.blog.get_entry(i)
> for com in ent.trackback_list():
> if com.title == "schrottblog": # com.blog_name == "schrottblog":
> # com.url == "http://schrottblog.com":
> ent.deleteTrackback(int(com.id))
I've been getting hit almost daily. I can't stand it anymore! So I made a
small improvement:
The statement ent.deleteTrackback(...) invokes method deleteTrackback() in
class Entry in the file Entry.py.
I added a property to the blog, called "close_zapped_trackbacks" and set it
to 1.
I then added code to in method deleteTrackback() to test for and act on
this property. Here's what the modified method looks like:
def deleteTrackback(self,id):
""" Delete a trackback """
if not id in self.trackbacks:
raise KeyError,"Trackback(ID:%d) does not exists."
self.trackbacks.remove(id)
# BEGIN ngps mods
cb = self.blog()
if cb.hasProperty("close_zapped_trackbacks") and
cb.getProperty("close_zapped_trackbacks") == 1:
self.receive_trackback = 2
# END ngps mods
self.moderated_trackback_count = self.moderated_trackback_count - 1
if self.moderated_trackback_count < 0:
self.moderated_trackback_count = 0
self.index()
self.aq_parent.deleteTrackback(id)
So when this script deletes a trackback spam, it also closes the entry to
all future trackbacks. Bit of a shotgun approach, but I'm willing to live
with it for now.
Cheers.
--
Ng Pheng Siong <[EMAIL PROTECTED]>
http://sandbox.rulemaker.net/ngps -+- M2Crypto, ZServerSSL for Zope, Blog
http://www.sqlcrypt.com -+- Transparent AES Encryption for SQLite
_______________________________________________
COREblog-en mailing list
[email protected]
http://postaria.com/cgi-bin/mailman/listinfo/coreblog-en
Unsubscription writing to [EMAIL PROTECTED]