<NME> db.py
<BEF> ADDFILE
<MSG> Important update of the plugin engine.
New plugin that allows the handling of an Amavisd-new SQL quarantine.

NB: a DB connections manager has been added inside the lib because
Django does not support multiple connections at the same time. The
main consequence is that we don't use an ORM and that we have to
rewrite a small wrapper that supports several DB (mysql, postgresql, etc.).
Adding a dependancy to an existing ORM module (like SQLalchemy) is
heavy, we don't want that for now.

<DFF> @@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+
+"""
+
+"""
+connections = {}
+
+def mysql_newconnection(host, dbname, login, password):
+    import MySQLdb
+    return MySQLdb.connect(host=host, db=dbname, user=login, passwd=password)
+
+def getconnection(name):
+    if not name in connections.keys():
+        from django.conf import settings
+        
+        cfg = settings.DB_CONNECTIONS[name]
+        if cfg["driver"] == "mysql":
+            conn = mysql_newconnection(cfg["host"], cfg["dbname"], cfg["login"], 
+                                       cfg["password"])
+        connections[name] = conn
+    return connections[name]
+        

Important update of the plugin engine. New plugin that allows the handling of an Amavisd-new SQL quarantine.