Django book pre-release

Today two first chapters of the Django Book are available online. There is a cool ajax based (YUI) comment system available for comments/corrections/etc. The book is available under the GNU Free Documentation License, which means it's free to read and redistribute. Next chapters are coming..seems two new chapters "The basics of generating Web pages" and "The Django template system" will be available on November 6, 2006. Updates are also available via Atom feed

Pinging Ping-O-Matic from Django blog

As soon as your blog content updates, you may want to ping some services like Technorati. Django already has module django.contrib.sitemaps, which can ping google along with sitemap generation. But what if you want to update other search engines too? There's a plenty of services, which support RPC, so it is possible to ping them once your blog got updated. Or you can use a wonderful service Ping-O-Matic, which will do the work for you.

Ping-O-Matic is a service to update different search engines that your blog has updated. You can let it know about your updates using ordinary GET request, or using RPC call. This RPC call is just an HTTP request with some details in xml format. Python has a great XML-RPC client library xmlrpclib which makes work with RPC simple and pleasant.

Here's the simple code, which you can save in your app directory:

That's all! Now all you need to do is to call it once your blog gets updated. This can be done by subclassing save() method of your model:

Entry is the name of my model in the Blog application.

Mailman and silently discarded messages

Several times people told me that message sent to mailman list just disappears and never sent to its subscribers. All messages had attachements, mostly excel files and doc files.

While i was trying to send some file attached into mail list - it was ok. I reset all options that could affect to the safe values:

max_message_size: 0
max_days_to_hold: 5  <- hold before automatic discarding
default_member_moderation: no
member_moderation_action: hold
generic_nonmember_action: hold
forward_auto_discards: yes
require_excplicite_destination: no
max_num_recipients: 10

And after all this i got discarded message again:

Sep 04 23:33:45 2006 (99752) Message discarded, msgid:
 <01f701c6d061$67f01430$0dcc090a@foo.bar>

I found only one place where this even occurs - it's in Mailman/Queue/IncomingRunner.py, Class IncomingRunner, method _dopipeline. Here's the code fragment:

line sys.modules[modname].process(mlist, msg, msgdata) calls method process() of one of those handlers, located in Mailman/Handlers. I grep'ed that dir and found that only followin handlers raise Errors.DiscardMessage exception:

  • MimeDel.py
  • Moderate.py
  • Scrubber.py
  • SpamDetect.py
  • ToDigest.py
And seems like this problem has something to do with MimeDel.py:

In my case mlist.filter_action == 3 though. Anyway, I was wondered when i found mlist.filter_content set to 1. Though filter_mime_types was empty and xls/doc wasn't in filter_filename_extensions

Im not sure if i found the real reason of why message was discrded, but i set filter_action to 0. In this case, the handler won't process the message at all:

And just to make sure i will know the name of the handler which discard the message next time ( if this happens again), i added a bit more info to the logging string in _dopipeline method:

To be continued... :)