launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #02291
[Merge] lp:~thumper/launchpad/fix-recipe-build-title into lp:launchpad
Tim Penhey has proposed merging lp:~thumper/launchpad/fix-recipe-build-title into lp:launchpad with lp:~thumper/launchpad/fix-recipe-build-oops as a prerequisite.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
#697255 LocationError raised in ppa +builds listing when recipe has no title
https://bugs.launchpad.net/bugs/697255
For more details, see:
https://code.launchpad.net/~thumper/launchpad/fix-recipe-build-title/+merge/45474
The title of a source package recipe build referred to the recipe.
It is possible that the recipe has been deleted.
I noticed the commonality with the tales adapter recently changed
(the dependent branch), so I moved that logic from the tales adapter
into the object itself.
I also took the opportunity to move the tales adapter itself into
the lp.code tree from lp.app.browser.tales.
--
https://code.launchpad.net/~thumper/launchpad/fix-recipe-build-title/+merge/45474
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~thumper/launchpad/fix-recipe-build-title into lp:launchpad.
=== modified file 'lib/lp/app/browser/configure.zcml'
--- lib/lp/app/browser/configure.zcml 2010-11-24 03:35:12 +0000
+++ lib/lp/app/browser/configure.zcml 2011-01-07 01:51:20 +0000
@@ -457,12 +457,6 @@
name="fmt"
/>
<adapter
- for="lp.code.interfaces.sourcepackagerecipebuild.ISourcePackageRecipeBuild"
- provides="zope.traversing.interfaces.IPathAdapter"
- factory="lp.app.browser.tales.SourcePackageRecipeBuildFormatterAPI"
- name="fmt"
- />
- <adapter
for="lp.blueprints.interfaces.specification.ISpecification"
provides="zope.traversing.interfaces.IPathAdapter"
factory="lp.app.browser.tales.SpecificationFormatterAPI"
=== modified file 'lib/lp/app/browser/tales.py'
--- lib/lp/app/browser/tales.py 2011-01-07 01:51:19 +0000
+++ lib/lp/app/browser/tales.py 2011-01-07 01:51:20 +0000
@@ -1642,22 +1642,6 @@
'owner': self._context.owner.displayname}
-class SourcePackageRecipeBuildFormatterAPI(CustomizableFormatter):
- """Adapter providing fmt support for ISourcePackageRecipe objects."""
-
- _link_summary_template = '%(name)s [%(owner)s/%(archive)s]'
-
- def _link_summary_values(self):
- if self._context.recipe is None:
- name = 'build for deleted recipe'
- else:
- branch_name = self._context.recipe.base_branch.unique_name
- name = '%s recipe build' % branch_name
- return {'name': name,
- 'owner': self._context.archive.owner.name,
- 'archive': self._context.archive.name}
-
-
class SpecificationFormatterAPI(CustomizableFormatter):
"""Adapter providing fmt support for Specification objects"""
=== modified file 'lib/lp/code/browser/configure.zcml'
--- lib/lp/code/browser/configure.zcml 2011-01-07 01:51:19 +0000
+++ lib/lp/code/browser/configure.zcml 2011-01-07 01:51:20 +0000
@@ -1198,6 +1198,12 @@
attribute_to_parent="archive"
path_expression="string:+build/${url_id}"
rootsite="code" />
+ <adapter
+ for="lp.code.interfaces.sourcepackagerecipebuild.ISourcePackageRecipeBuild"
+ provides="zope.traversing.interfaces.IPathAdapter"
+ factory="lp.code.browser.sourcepackagerecipebuild.SourcePackageRecipeBuildFormatterAPI"
+ name="fmt"
+ />
<browser:menus
classes="SourcePackageRecipeBuildContextMenu"
module="lp.code.browser.sourcepackagerecipebuild"/>
=== modified file 'lib/lp/code/browser/sourcepackagerecipebuild.py'
--- lib/lp/code/browser/sourcepackagerecipebuild.py 2010-11-26 00:29:09 +0000
+++ lib/lp/code/browser/sourcepackagerecipebuild.py 2011-01-07 01:51:20 +0000
@@ -29,6 +29,7 @@
action,
LaunchpadFormView,
)
+from lp.app.browser.tales import CustomizableFormatter
from lp.buildmaster.enums import BuildStatus
from lp.code.interfaces.sourcepackagerecipebuild import (
ISourcePackageRecipeBuild,
@@ -43,6 +44,18 @@
BuildStatus.SUPERSEDED,
BuildStatus.FAILEDTOUPLOAD,)
+
+class SourcePackageRecipeBuildFormatterAPI(CustomizableFormatter):
+ """Adapter providing fmt support for ISourcePackageRecipeBuild objects."""
+
+ _link_summary_template = '%(title)s [%(owner)s/%(archive)s]'
+
+ def _link_summary_values(self):
+ return {'title': self._context.title,
+ 'owner': self._context.archive.owner.name,
+ 'archive': self._context.archive.name}
+
+
class SourcePackageRecipeBuildNavigation(Navigation, FileNavigationMixin):
usedfor = ISourcePackageRecipeBuild
=== modified file 'lib/lp/code/model/sourcepackagerecipebuild.py'
--- lib/lp/code/model/sourcepackagerecipebuild.py 2010-12-20 20:36:16 +0000
+++ lib/lp/code/model/sourcepackagerecipebuild.py 2011-01-07 01:51:20 +0000
@@ -152,7 +152,11 @@
@property
def title(self):
- return '%s recipe build' % self.recipe.base_branch.unique_name
+ if self.recipe is None:
+ return 'build for deleted recipe'
+ else:
+ branch_name = self.recipe.base_branch.unique_name
+ return '%s recipe build' % branch_name
def __init__(self, package_build, distroseries, recipe, requester):
"""Construct a SourcePackageRecipeBuild."""