← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~stevenk/launchpad/archive-picker-value into lp:launchpad

 

Steve Kowalik has proposed merging lp:~stevenk/launchpad/archive-picker-value into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #719795 in Launchpad itself: "Recipe archive picker items are twice the required height"
  https://bugs.launchpad.net/launchpad/+bug/719795

For more details, see:
https://code.launchpad.net/~stevenk/launchpad/archive-picker-value/+merge/66318

Change the picker used by the daily build archive field to move the text in brackets to the second line.

This is not tested at all, but it seems that none of the PickerEntry infrastructure is tested at all.
-- 
https://code.launchpad.net/~stevenk/launchpad/archive-picker-value/+merge/66318
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/archive-picker-value into lp:launchpad.
=== modified file 'lib/lp/app/browser/configure.zcml'
--- lib/lp/app/browser/configure.zcml	2011-06-10 18:34:34 +0000
+++ lib/lp/app/browser/configure.zcml	2011-06-29 14:46:01 +0000
@@ -414,6 +414,10 @@
     factory="lp.app.browser.vocabulary.SourcePackageNamePickerEntryAdapter"
     />
 
+  <adapter
+    factory="lp.app.browser.vocabulary.ArchivePickerEntryAdapter"
+    />
+
   <!-- TALES namespaces. -->
 
   <!-- TALES lp: namespace (should be deprecated) -->

=== modified file 'lib/lp/app/browser/vocabulary.py'
--- lib/lp/app/browser/vocabulary.py	2011-06-03 12:26:05 +0000
+++ lib/lp/app/browser/vocabulary.py	2011-06-29 14:46:01 +0000
@@ -42,6 +42,7 @@
 from lp.registry.model.pillaraffiliation import IHasAffiliation
 from lp.registry.model.sourcepackagename import getSourcePackageDescriptions
 from lp.services.features import getFeatureFlag
+from lp.soyuz.interfaces.archive import IArchive
 
 # XXX: EdwinGrubbs 2009-07-27 bug=405476
 # This limits the output to one line of text, since the sprite class
@@ -186,6 +187,18 @@
         return extra
 
 
+@adapter(IArchive)
+class ArchivePickerEntryAdapter(DefaultPickerEntryAdapter):
+    """Adapts IArchive to IPickerEntry."""
+
+    def getPickerEntry(self, associated_object, **kwarg):
+        archive = self.context
+        extra = super(ArchivePickerEntryAdapter, self).getPickerEntry(
+            associated_object)
+        extra.description = '%s/%s' % (archive.owner.name, archive.name)
+        return extra
+
+
 class HugeVocabularyJSONView:
     """Export vocabularies as JSON.
 

=== modified file 'lib/lp/soyuz/browser/archive.py'
--- lib/lp/soyuz/browser/archive.py	2011-06-23 16:11:42 +0000
+++ lib/lp/soyuz/browser/archive.py	2011-06-29 14:46:01 +0000
@@ -1413,7 +1413,7 @@
     terms = []
     for archive in archives:
         token = '%s/%s' % (archive.owner.name, archive.name)
-        label = '%s (%s)' % (archive.displayname, token)
+        label = archive.displayname
         terms.append(SimpleTerm(archive, token, label))
     return SimpleVocabulary(terms)