Merge lp:~lifeless/launchpad/malone into lp:launchpad
Proposed by
Robert Collins
on 2010-09-15
| Status: | Merged | ||||
|---|---|---|---|---|---|
| Approved by: | Robert Collins on 2010-09-16 | ||||
| Approved revision: | no longer in the source branch. | ||||
| Merged at revision: | 11557 | ||||
| Proposed branch: | lp:~lifeless/launchpad/malone | ||||
| Merge into: | lp:launchpad | ||||
| Prerequisite: | lp:~lifeless/launchpad/decoratedresultset | ||||
| Diff against target: |
259 lines (+143/-26) 4 files modified
lib/canonical/launchpad/database/message.py (+7/-2) lib/lp/bugs/model/bug.py (+95/-14) lib/lp/bugs/tests/test_bugs_webservice.py (+41/-4) lib/lp/bugs/tests/test_searchtasks_webservice.py (+0/-6) |
||||
| To merge this branch: | bzr merge lp:~lifeless/launchpad/malone | ||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Edwin Grubbs (community) | code | 2010-09-15 | Approve on 2010-09-15 |
|
Review via email:
|
|||
Commit Message
Remove listification from the internals of the bugs/message API.
Description of the Change
Remove listification from the internals of the bugs/message API.
To post a comment you must log in.

Hi Robert,
This is a nice improvement. I have a few comments below.
-Edwin
>=== modified file 'lib/canonical/ launchpad/ database/ message. py' launchpad/ database/ message. py 2010-08-29 21:24:47 +0000 launchpad/ database/ message. py 2010-09-15 19:20:47 +0000 self): chunks_ text(self. chunks)
>--- lib/canonical/
>+++ lib/canonical/
>@@ -158,10 +159,14 @@
> """See IMessage."""
> return self.owner
>
>- @property
>+ @cachedproperty
> def text_contents(
> """See IMessage."""
>- bits = [unicode(chunk) for chunk in self if chunk.content]
>+ return Message.
>+
>+ @classmethod
>+ def chunks_text(klass, chunks):
PEP8 wants you to use cls instead of klass.
>+ bits = [unicode(chunk) for chunk in chunks if chunk.content] bugs/model/ bug.py' bugs/model/ bug.py 2010-09-09 17:02:33 +0000 bugs/model/ bug.py 2010-09-15 19:20:47 +0000 messages( self): `.""" messages( content= True) messages( self, content=False):
> return '\n\n'.join(bits)
>
> # XXX flacoste 2006-09-08: Bogus attribute only present so that
>
>=== modified file 'lib/lp/
>--- lib/lp/
>+++ lib/lp/
>@@ -58,6 +58,7 @@
> SQLRaw,
> Union,
> )
>+from storm.info import ClassAlias
> from storm.store import (
> EmptyResultSet,
> Store,
>@@ -426,21 +427,79 @@
> @property
> def indexed_
> """See `IMessageTarget
>+ return self._indexed_
>+
>+ def _indexed_
>+ """Get the bugs messages, indexed.
>+
>+ :param content: If True retrieve the content for the msssages too.
s/msssages/ messages/
The "content" parameter sounds more like it should contain content
as opposed to being a boolean. How about "include_content" instead?
>+ """ bugtask messages) : message, inside, index, parent) messages. append( indexed_ message) owners( rows):
>+ # Make all messages be 'in' the main bugtask.
> inside = self.default_
>- messages = list(self.messages)
>- message_set = set(messages)
>-
>- indexed_messages = []
>- for index, message in enumerate(
>- if message.parent not in message_set:
>- parent = None
>- else:
>- parent = message.parent
>-
>- indexed_message = IndexedMessage(
>- indexed_
>-
>- return indexed_messages
>+ store = Store.of(self)
>+ message_by_id = {}
>+ def eager_load_
>+ # Because we may have multiple owners, we spend less time in storm
>+ # with very large bugs by not joining and instead querying a second
>+ # time. If this starts to show high db time, we can left outer join
Long lines.
>+ # instead. discard( None) find(Person, Person. id.is_in( owner_ids) )) content( rows):
>+ owner_ids = set(row[0].ownerID for row in rows)
>+ owner_ids.
>+ if not owner_ids:
>+ return
>+ list(store.
>+ def eager_load_
>+ # To avoid the complexity of having multiple rows per
>+ # message, or joining in the database (though perhaps in
>+ # future we should do that), we do a single separate query
>+ # for the message content.
...