diff mbox

[Branch,~linaro-validation/lava-dashboard/trunk] Rev 268: Use breadcrumbs from lava-server

Message ID 20111003122614.15457.91486.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Zygmunt Krynicki Oct. 3, 2011, 12:26 p.m. UTC
------------------------------------------------------------
revno: 268
committer: Zygmunt Krynicki <zygmunt.krynicki@linaro.org>
branch nick: trunk
timestamp: Fri 2011-09-30 15:34:54 +0200
message:
  Use breadcrumbs from lava-server
modified:
  dashboard_app/bread_crumbs.py


--
lp:lava-dashboard
https://code.launchpad.net/~linaro-validation/lava-dashboard/trunk

You are subscribed to branch lp:lava-dashboard.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-dashboard/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'dashboard_app/bread_crumbs.py'
--- dashboard_app/bread_crumbs.py	2011-07-12 02:34:12 +0000
+++ dashboard_app/bread_crumbs.py	2011-09-30 13:34:54 +0000
@@ -16,71 +16,11 @@ 
 # You should have received a copy of the GNU Affero General Public License
 # along with Launch Control.  If not, see <http://www.gnu.org/licenses/>.
 
-from django.core.urlresolvers import reverse
-import logging
-
-
-class BreadCrumb(object):
-
-    def __init__(self, name, parent=None, needs=None):
-        self.name = name
-        self.view = None
-        self.parent = parent
-        self.needs = needs or []
-
-    def __repr__(self):
-        return "<BreadCrumb name=%r view=%r parent=%r>" % (
-            self.name, self.view, self.parent)
-
-    def __call__(self, view):
-        self.view = view
-        view._bread_crumb = self
-        return view
-
-    def get_name(self, kwargs):
-        try:
-            return self.name.format(**kwargs)
-        except:
-            logging.exception("Unable to construct breadcrumb name for view %r", self.view)
-            raise
-
-    def get_absolute_url(self, kwargs):
-        try:
-            return reverse(self.view, args=[kwargs[name] for name in self.needs])
-        except:
-            logging.exception("Unable to construct breadcrumb URL for view %r", self.view)
-            raise
-
-
-class LiveBreadCrumb(object):
-
-    def __init__(self, bread_crumb, kwargs):
-        self.bread_crumb = bread_crumb
-        self.kwargs = kwargs
-
-    def get_name(self):
-        return self.bread_crumb.get_name(self.kwargs)
-
-    def get_absolute_url(self):
-        return self.bread_crumb.get_absolute_url(self.kwargs)
-
-
-class BreadCrumbTrail(object):
-
-    def __init__(self, bread_crumb_list, kwargs):
-        self.bread_crumb_list = bread_crumb_list
-        self.kwargs = kwargs
-
-    def __iter__(self):
-        for bread_crumb in self.bread_crumb_list:
-            yield LiveBreadCrumb(bread_crumb, self.kwargs)
-
-    @classmethod
-    def leading_to(cls, view, **kwargs):
-        lst = []
-        while view is not None:
-            lst.append(view._bread_crumb)
-            view = view._bread_crumb.parent
-        lst.reverse()
-        return cls(lst, kwargs or {})
-
+
+"""
+Deprecated bread crumb module.
+
+Bread crubms are now part of lava server
+"""
+
+from lava_server.bread_crumbs import BreadCrumb, LiveBreadCrumb, BreadCrumbTrail