[mirrorbrain-commits] r7705 - in trunk: . mirrordoctor/mb

From: <poeml_at_mirrorbrain.org>
Date: Tue, 28 Jul 2009 00:35:57 +0200
Author: poeml
Date: Tue Jul 28 00:35:57 2009
New Revision: 7705
URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain?view=revision&revision=7705

Log:
Remove a restriction in the mb tool which made it require mod_asn to be
installed alongside MirrorBrain. The dependency has been removed now.

Modified:
   trunk/BUGS
   trunk/mirrordoctor/mb/asn.py
   trunk/mirrordoctor/mb/conn.py

Modified: trunk/BUGS
==============================================================================
--- trunk/BUGS	Tue Jul 28 00:29:58 2009	(r7704)
+++ trunk/BUGS	Tue Jul 28 00:35:57 2009	(r7705)
_at_@ -1,8 +1,5 @@
 more important bugs at the top!
 
-* mod_asn is required right now to run the mb tool. Otherwise, the tool crashes with
-  'relation "pfx2asn" does not exist' error. This dependency should be removed.
-
 * metalinks will likely use RFC3339 timestamps instead of RFC822 timestamps in
   the future (IETF draft w.i.p.). No client makes use of the data yet. Cf.
   http://groups.google.com/group/metalink-discussion/browse_thread/thread/44489ba99916aced

Modified: trunk/mirrordoctor/mb/asn.py
==============================================================================
--- trunk/mirrordoctor/mb/asn.py	Tue Jul 28 00:29:58 2009	(r7704)
+++ trunk/mirrordoctor/mb/asn.py	Tue Jul 28 00:35:57 2009	(r7705)
_at_@ -32,7 +32,12 @@
                    ORDER BY ip4r_size(pfx) \
                    LIMIT 1""" % a.ip
 
-    res = conn.Pfx2asn._connection.queryAll(query)
+    try:
+        res = conn.Pfx2asn._connection.queryAll(query)
+    except AttributeError:
+        # we get this error if mod_asn isn't installed as well
+        return a
+
     if len(res) != 1:
         return a
     (a.prefix, a.asn) = res[0]

Modified: trunk/mirrordoctor/mb/conn.py
==============================================================================
--- trunk/mirrordoctor/mb/conn.py	Tue Jul 28 00:29:58 2009	(r7704)
+++ trunk/mirrordoctor/mb/conn.py	Tue Jul 28 00:35:57 2009	(r7705)
_at_@ -144,12 +144,17 @@
                 defaultOrder = 'code'
         self.Region = Region
 
-        class Pfx2asn(SQLObject):
-            """the pfx2asn table"""
-            class sqlmeta:
-                fromDatabase = True
-                defaultOrder = 'asn'
-        self.Pfx2asn = Pfx2asn
+        try:
+            class Pfx2asn(SQLObject):
+                """the pfx2asn table"""
+                class sqlmeta:
+                    fromDatabase = True
+                    defaultOrder = 'asn'
+            self.Pfx2asn = Pfx2asn
+        except psycopg2.ProgrammingError:
+            # this is the error which we get if mod_asn doesn't happen
+            # to be installed as well
+            pass
 
         if debug:
             self.Server._connection.debug = True


_______________________________________________
mirrorbrain-commits mailing list
Archive: http://mirrorbrain.org/archive/mirrorbrain-commits/

Note: To remove yourself from this list, send a mail with the content
 	unsubscribe
to the address mirrorbrain-commits-request_at_mirrorbrain.org
Received on Mon Jul 27 2009 - 22:35:59 GMT

This archive was generated by hypermail 2.3.0 : Mon Feb 20 2012 - 23:47:04 GMT