deletion of all featured projects causes broken main page + fix CSS

Bug #477453 reported by loki
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
High
Unassigned

Bug Description

steps to reproduce:
1. go to https://launchpad.dev/+featuredprojects
2. delete all projects
3. go to main page https://launchpad.dev

act. results: exception message

exp. results: main page

Tags: lp-registry

Related branches

Revision history for this message
Diogo Matsubara (matsubara) wrote :

Although this is quite unlikely to happen in the production instance, it'd be nice to have a good fallback.

affects: launchpad → launchpad-registry
Changed in launchpad-registry:
status: New → Triaged
Curtis Hovey (sinzui)
Changed in launchpad-registry:
importance: Undecided → Low
Revision history for this message
loki (sergiy-vynnychenko) wrote :

Launchad is Open Source for now.
there is much probability it can happen on fresh custom installation like mine.

Revision history for this message
Curtis Hovey (sinzui) wrote :

Patches are welcome. While this is a real bug, it is unlikely to happen in our hosted service. Developers can easily fix their development instance. The code was opened so that the community can develop the service to meet the community's needs. Keep in mind that the Launchpad art is is not free, so a lot of work is need to run a local instance in production--helping others customise Launchpad is not a priority.

Revision history for this message
loki (sergiy-vynnychenko) wrote :

>> helping others customise Launchpad is not a priority.

und!

I'd like to fix it by myself, but i'm new to Launchpad/Zope/Bazaar stuff.

If someone can give me advice where in code i can find it and how to include that into unit tests - i will submit a patch.

I want to use Launchpad for our commercial projects with local server (so copyrighted art is not a problem). So i'm ready for collaboration with Launchpad in ways profitable for me. But at first I need to examine how it works.

Revision history for this message
Curtis Hovey (sinzui) wrote :

Hi Loki

While looking into this I got so angry at what I found that I am going to fix this now. This is what I was typing before I hit the point where I decided to JFDI. I'll fix your bug and my own dislike of this implementation.

Wow. This code really sucks.
    * Why does the template use ids for the layout? Ids are forbidden in the global stylesheet.
    * Why are non reusable styles in the global stylesheet?
    * The styles look like a private implementation of .two-column-list
    * The view's implementation imposes a design that does not exist (it assumes a table layout).
    * The template should use view/features_projects and iterate to create an <li>

The correct fix is to
    * inline the #homepage and .homepage styles in the template's head_epilogue slot
    * Change the template to use the approved two-column-list
    * Update the template to use view/featured projects
    * Delete the crack properties (featured_projects_col_a, featured_projects_col_b)

The top_project in your case is conditional so we need to check the length of projects before trying to pop it. The template needs a simple condition to not render the top project.

=== modified file 'lib/canonical/launchpad/templates/root-index.pt'
--- lib/canonical/launchpad/templates/root-index.pt 2009-10-30 17:37:45 +0000
+++ lib/canonical/launchpad/templates/root-index.pt 2009-11-13 15:20:05 +0000
@@ -163,7 +163,8 @@
             <div id="homepage-featured" class="homepage-portlet">
               <h2>Featured projects</h2>
               <div id="homepage-featured-top"
- tal:define="topproject view/featured_projects_top">
+ tal:define="topproject view/featured_projects_top"
+ tal:condition="topproject">
                 <a tal:attributes="href topproject/fmt:url">
                   <img tal:replace="structure topproject/image:logo" />
                   <div id="homepage-featured-top-title">

=== modified file 'lib/lp/registry/browser/root.py'
--- lib/lp/registry/browser/root.py 2009-09-22 20:47:30 +0000
+++ lib/lp/registry/browser/root.py 2009-11-13 15:18:17 +0000
@@ -82,8 +82,11 @@
             getUtility(IPillarNameSet).featured_projects)[:max_projects]
         # Select and get the top featured project (project of the day) and
         # remove it from the list.
- top_project = self._get_day_of_year() % len(self.featured_projects)
- self.featured_projects_top = self.featured_projects.pop(top_project)
+ project_count = len(self.featured_projects)
+ if project_count > 0:
+ top_project = self._get_day_of_year() % project_count
+ self.featured_projects_top = self.featured_projects.pop(
+ top_project)

     def canRedirect(self):
         """Return True if the beta server is available to the user."""

Revision history for this message
Curtis Hovey (sinzui) wrote :

I am marking this High because the CSS issues can cause greater problems in the next few weeks because we should remove the 1.0 and 2.0 style hacks.

Changed in launchpad-registry:
milestone: none → 3.1.11
assignee: nobody → Curtis Hovey (sinzui)
assignee: Curtis Hovey (sinzui) → nobody
importance: Low → High
milestone: 3.1.11 → none
summary: - deletion of all featured projects causes broken main page
+ deletion of all featured projects causes broken main page + fix CSS
Curtis Hovey (sinzui)
Changed in launchpad-registry:
assignee: nobody → Curtis Hovey (sinzui)
milestone: none → 3.1.11
status: Triaged → In Progress
Revision history for this message
William Grant (wgrant) wrote :

loki, you say "I want to use Launchpad for our commercial projects with local server (so copyrighted art is not a problem)." How is it not a problem? You still can't use the restrictively licensed components.

Revision history for this message
loki (sergiy-vynnychenko) wrote :

yeah, I see.
https://dev.launchpad.net/LaunchpadLicense

I thought it can be used in private networks. But i was wrong. I'll fix it.
do you have the exact list of all copyrighted images?

current situation is pitfall, there should exist some simple and clear way to avoid such situations.

possible solutions:
1. txt file with exact list of copyrighted materials
2. brunch without copyrighted stuff
3. installation script should ask "do you want to replace copyrighted material with stub images?"

Revision history for this message
Curtis Hovey (sinzui) wrote :

Fixed in Launchpad devel r9890.

Changed in launchpad-registry:
status: In Progress → Fix Committed
Revision history for this message
Curtis Hovey (sinzui) wrote : Bug 477453 Fix released

Fixed released in launchpad-project 3.1.11.

Changed in launchpad-registry:
status: Fix Committed → Fix Released
Curtis Hovey (sinzui)
Changed in launchpad:
assignee: Curtis Hovey (sinzui) → nobody
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.