Merge lp:~stevenk/launchpad/information_type-vocab into lp:launchpad
Proposed by
Steve Kowalik
on 2012-04-11
| Status: | Merged |
|---|---|
| Approved by: | Steve Kowalik on 2012-04-11 |
| Approved revision: | no longer in the source branch. |
| Merged at revision: | 15078 |
| Proposed branch: | lp:~stevenk/launchpad/information_type-vocab |
| Merge into: | lp:launchpad |
| Diff against target: |
266 lines (+162/-3) 6 files modified
lib/lp/bugs/browser/bug.py (+27/-1) lib/lp/bugs/browser/tests/test_bugview.py (+20/-1) lib/lp/registry/tests/test_information_type_vocabulary.py (+65/-0) lib/lp/registry/vocabularies.py (+31/-0) lib/lp/registry/vocabularies.zcml (+7/-1) lib/lp/services/features/flags.py (+12/-0) |
| To merge this branch: | bzr merge lp:~stevenk/launchpad/information_type-vocab |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| William Grant | code | 2012-04-11 | Approve on 2012-04-11 |
|
Review via email:
|
|||
Commit Message
Add a vocabulary for the InformationType enum, which allows us to change what is displayed via feature flags.
Description of the Change
Add a vocabulary for the InformationType enum. I have added two feature flags, one that changes User Data to display as Private, and the other that hides Proprietary. I have pulled in some code into BugView which is tested, but not used yet to make later branches a little smaller.
This branch isn't testable on it's own, it is just setting up plumbing for the upcoming UI branches.
To post a comment you must log in.

25 + cache.objects[ 'information_ types'] = [ Vocabulary( )]
26 + {'value': term.value, 'description': term.description,
27 + 'name': term.title} for term in InformationType
This seems like a common pattern. Is there a helper? If not, might it be an idea to add one?
28 + cache.objects[ 'private_ types'] = [ INFORMATION_ TYPES]
29 + type.value for type in PRIVATE_
type.value is the integer. Enums are not represented by integers, except at the database layer.
30 + cache.objects[ 'initial_ information_ type'] = ( context) .information_ type.value)
31 + IBug(self.
Likewise. But isn't this already in LP.cache.context?
40 + @property type(self) :
41 + def information_
I'd like a comment stating that this whole mess can be replaced with bug.information _type.title once we switch to showing User Data.
83 + def test_informatio n_type_ feature_ flag(self) :
This could do with a comment and a better name.
115 + def test_getTermByT oken(self) : Vocabulary( ) Token(' PUBLIC' ) l(InformationTy pe.PUBLIC, term.value) l('PUBLIC' , term.token) l('Public' , term.title) .PUBLIC. description, term.description)
116 + vocab = InformationType
117 + term = vocab.getTermBy
118 + self.assertEqua
119 + self.assertEqua
120 + self.assertEqua
121 + self.assertEqual(
122 + InformationType
Do you know about MatchesStructure?
214 + term = SimpleTerm(type, type.name, title)
215 + term.description = description
Does the constructor seriously not take description?