web: fix handling of reliability page when Numeric is not available
authorBrian Warner <warner@lothar.com>
Tue, 17 Feb 2009 02:56:58 +0000 (19:56 -0700)
committerBrian Warner <warner@lothar.com>
Tue, 17 Feb 2009 02:56:58 +0000 (19:56 -0700)
src/allmydata/web/reliability.py
src/allmydata/web/root.py

index 72474f38c584ad92f7cd5775d21963bb8610eba5..796f614d9ddd6a425b30067b091700ef88bc9c33 100644 (file)
@@ -12,6 +12,11 @@ DAY=24*60*60
 MONTH=31*DAY
 YEAR=365*DAY
 
+def is_available():
+    if reliability:
+        return True
+    return False
+
 def yandm(seconds):
     return "%dy.%dm" % (int(seconds/YEAR), int( (seconds%YEAR)/MONTH))
 
index b8f7b1a8d6900c8e0373441c3f44751a80fb7233..3a57e6b32b909f523a34f2e1b56d337d192c8c57 100644 (file)
@@ -11,14 +11,10 @@ from formless import webform
 import allmydata # to display import path
 from allmydata import get_package_versions_string
 from allmydata import provisioning
-reliability = None
-try:
-    from allmydata.web import reliability # requires Numeric and PIL
-except ImportError:
-    pass # might not be usable
 from allmydata.util import idlib, log
 from allmydata.interfaces import IFileNode
 from allmydata.web import filenode, directory, unlinked, status, operations
+from allmydata.web import reliability
 from allmydata.web.common import abbreviate_size, IClient, \
      getxmlfile, WebError, get_arg, RenderMixin
 
@@ -149,7 +145,7 @@ class Root(rend.Page):
     child_tahoe_css = nevow_File(resource_filename('allmydata.web', 'tahoe.css'))
 
     child_provisioning = provisioning.ProvisioningTool()
-    if reliability:
+    if reliability.is_available():
         child_reliability = reliability.ReliabilityTool()
     else:
         child_reliability = NoReliability()