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.
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. projects and iterate to create an <li>
* 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_
The correct fix is to projects_ col_a, featured_ projects_ col_b)
* 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_
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' launchpad/ templates/ root-index. pt 2009-10-30 17:37:45 +0000 launchpad/ templates/ root-index. pt 2009-11-13 15:20:05 +0000 featured" class=" homepage- portlet" >
<h2>Featured projects</h2> featured- top" "topproject view/featured_ projects_ top"> "topproject view/featured_ projects_ top" "topproject" > "href topproject/ fmt:url" >
<img tal:replace= "structure topproject/ image:logo" />
<div id="homepage- featured- top-title" >
--- lib/canonical/
+++ lib/canonical/
@@ -163,7 +163,8 @@
<div id="homepage-
<div id="homepage-
- tal:define=
+ tal:define=
+ tal:condition=
<a tal:attributes=
=== modified file 'lib/lp/ registry/ browser/ root.py' registry/ browser/ root.py 2009-09-22 20:47:30 +0000 registry/ browser/ root.py 2009-11-13 15:18:17 +0000
getUtilit y(IPillarNameSe t).featured_ projects) [:max_projects] day_of_ year() % len(self. featured_ projects) projects_ top = self.featured_ projects. pop(top_ project) featured_ projects) day_of_ year() % project_count projects_ top = self.featured_ projects. pop(
--- lib/lp/
+++ lib/lp/
@@ -82,8 +82,11 @@
# Select and get the top featured project (project of the day) and
# remove it from the list.
- top_project = self._get_
- self.featured_
+ project_count = len(self.
+ if project_count > 0:
+ top_project = self._get_
+ self.featured_
+ top_project)
def canRedirect(self):
"""Return True if the beta server is available to the user."""