From 7ae0910df8629d4e3045cb12b84db018b52ed348 Mon Sep 17 00:00:00 2001 From: Antoine Nguyen Date: Wed, 19 Sep 2012 08:56:53 +0200 Subject: [PATCH] Some comments. see #298 --- modoboa/extensions/amavis/sql_listing.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/modoboa/extensions/amavis/sql_listing.py b/modoboa/extensions/amavis/sql_listing.py index ce83b08b0..7a7507edf 100644 --- a/modoboa/extensions/amavis/sql_listing.py +++ b/modoboa/extensions/amavis/sql_listing.py @@ -83,6 +83,17 @@ class SQLconnector(MBconnector): class SQLWrapper(object): + """A simple SQL wrapper. + + This wrapper has been added just to answer the *Postgres bytea + fields* issue :p + + The base class doesn't add anything special but defines the method + (and so piece of SQL queries) that should be overloaded when + Postgres is in use. + + See ``PgWrapper`` for the real mess... + """ def get_mails(self, request, rcptfilter=None): if request.GET.get("viewrequests", None) == "1": @@ -130,6 +141,11 @@ class SQLWrapper(object): return Quarantine.objects.filter(mail=mail_id) class PgWrapper(SQLWrapper): + """The postgres wrapper + + Make use of ``QuerySet.extra`` and postgres ``convert_from`` + function to let the quarantine manager work as expected ! + """ def get_mails(self, request, rcptfilter=None): if request.GET.get("viewrequests", None) == "1": @@ -189,6 +205,10 @@ class PgWrapper(SQLWrapper): ) def get_wrapper(): + """Return the appropriate *Wrapper class + + The result depends on the DB engine in use. + """ if db_type() == 'postgres': return PgWrapper() return SQLWrapper()