Switch to unified view

a/Allura/allura/model/project.py b/Allura/allura/model/project.py
...
...
391
        from allura.app import SitemapEntry
391
        from allura.app import SitemapEntry
392
        entries = []
392
        entries = []
393
393
394
        anchored_tools =self.neighborhood.get_anchored_tools()
394
        anchored_tools =self.neighborhood.get_anchored_tools()
395
        i = len(anchored_tools)
395
        i = len(anchored_tools)
396
        self.install_anchored_tools()
396
        new_tools = self.install_anchored_tools()
397
397
398
        # Set menu mode
398
        # Set menu mode
399
        delta_ordinal = i
399
        delta_ordinal = i
400
        max_ordinal = i
400
        max_ordinal = i
401
401
...
...
407
        for sub in self.direct_subprojects:
407
        for sub in self.direct_subprojects:
408
            ordinal = sub.ordinal + delta_ordinal
408
            ordinal = sub.ordinal + delta_ordinal
409
            if ordinal > max_ordinal:
409
            if ordinal > max_ordinal:
410
                max_ordinal = ordinal
410
                max_ordinal = ordinal
411
            entries.append({'ordinal':sub.ordinal + delta_ordinal,'entry':SitemapEntry(sub.name, sub.url())})
411
            entries.append({'ordinal':sub.ordinal + delta_ordinal,'entry':SitemapEntry(sub.name, sub.url())})
412
        for ac in self.app_configs:
412
        for ac in self.app_configs + [a.config for a in new_tools]:
413
            if excluded_tools and ac.tool_name in excluded_tools:
413
            if excluded_tools and ac.tool_name in excluded_tools:
414
                continue
414
                continue
415
            # Tool could've been uninstalled in the meantime
415
            # Tool could've been uninstalled in the meantime
416
            try:
416
            try:
417
                App = ac.load()
417
                App = ac.load()
...
...
442
442
443
    def install_anchored_tools(self):
443
    def install_anchored_tools(self):
444
        anchored_tools = self.neighborhood.get_anchored_tools()
444
        anchored_tools = self.neighborhood.get_anchored_tools()
445
        installed_tools = [tool.tool_name.lower() for tool in self.app_configs]
445
        installed_tools = [tool.tool_name.lower() for tool in self.app_configs]
446
        i = 0
446
        i = 0
447
        new_tools = []
447
        if not self.is_nbhd_project:
448
        if not self.is_nbhd_project:
448
            for tool, label in anchored_tools.iteritems():
449
            for tool, label in anchored_tools.iteritems():
449
                if tool not in installed_tools:
450
                if tool not in installed_tools:
450
                    try:
451
                    try:
451
                        self.install_app(tool, tool, label, i)
452
                        new_tools.append(self.install_app(tool, tool, label, i))
452
                    except Exception:
453
                    except Exception:
453
                        log.error('%s is not available' % tool, exc_info=True)
454
                        log.error('%s is not available' % tool, exc_info=True)
454
                i += 1
455
                i += 1
456
        return new_tools
455
457
456
    def grouped_navbar_entries(self):
458
    def grouped_navbar_entries(self):
457
        """Return a ``allura.app.SitemapEntry`` list suitable for rendering
459
        """Return a ``allura.app.SitemapEntry`` list suitable for rendering
458
        the project navbar with tools grouped together by tool type.
460
        the project navbar with tools grouped together by tool type.
459
        """
461
        """