Merge lp:~stevenk/launchpad/dsp-vocab into lp:launchpad
| Status: | Merged |
|---|---|
| Approved by: | Steve Kowalik on 2011-06-24 |
| Approved revision: | no longer in the source branch. |
| Merged at revision: | 13298 |
| Proposed branch: | lp:~stevenk/launchpad/dsp-vocab |
| Merge into: | lp:launchpad |
| Diff against target: |
277 lines (+243/-0) 2 files modified
lib/lp/registry/tests/test_dsp_vocabularies.py (+144/-0) lib/lp/registry/vocabularies.py (+99/-0) |
| To merge this branch: | bzr merge lp:~stevenk/launchpad/dsp-vocab |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Jeroen T. Vermeulen (community) | Approve on 2011-06-24 | ||
| Ian Booth (community) | 2011-06-24 | Needs Information on 2011-06-24 | |
|
Review via email:
|
|||
Commit Message
[r=jtv][bug=42298][incr] Add DistributionSou
Description of the Change
Add a new vocab for DistributionSou
| Jeroen T. Vermeulen (jtv) wrote : | # |
Don't do column.like('%' + search_term + '%') — that gets messy with the escaping. Use column.
| Jeroen T. Vermeulen (jtv) wrote : | # |
Is there no helper class you can derive your huge vocabulary from? Please have a test self.assertThat
| Jeroen T. Vermeulen (jtv) wrote : | # |
I made a few notes about things that should be changed, but apart from those it's fine with me. If this breaks when we start using it, we'll see then. If it's too slow, a timeout on an experimental page will tell us much more than a-priori reasoning. And if it gives the wrong results, we'll call that progressing insight. A branch in devel is worth two in the bush.
One tip: I find unit tests get massively clearer when I name them after the "facts" they establish, rather than just after the function or variation they test. So not just "test_fooBar" but "test_fooBar_
This comes from the behaviorologist or behavior-oriented or best-behavior or something along those lines school of software development that I've heard faint whisperings of.

Some initial thoughts:
The toTerm() implementation looks wrong I think. toTerm() takes 3 parameters: obj, token, title. IIRC obj should be the data item represented by the Term and is what your business logic in the form submission callback gets, in this case dsp. I think(?) you want something like:
SimpleTerm(dsp, %s-%s' % (dsp.distributi on.name, dsp.name), 'xxxx') where xxxx is whatever user text you want displayed in the ui.
It appears there's scope for the toTerm to execute sql in getting the data it needs. Have you profiled it? Perhaps there's a need to prefetch/eager load the built binaries info.