~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/answers/doc/question.txt

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-04-26 03:31:28 UTC
  • mfrom: (12906.3.9 question-recipients-0)
  • Revision ID: launchpad@pqm.canonical.com-20110426033128-zql6rkchbtcsypk6
[r=benji][bug=769160][bug=185427] Question email performance and
 reason improvements.

Show diffs side-by-side

added added

removed removed

Lines of Context:
194
194
 
195
195
The getDirectSubscribers() method returns a sorted list of subscribers.
196
196
This method iterates like the NotificationRecipientSet returned by the
197
 
getDirectRecipients() method.
 
197
direct_recipients method.
198
198
 
199
199
    >>> for person in firefox_question.getDirectSubscribers():
200
200
    ...     print person.displayname
210
210
 
211
211
The people on the subscription list are said to be directly subscribed to the
212
212
question.  They explicitly chose to get notifications about that particular
213
 
question.  This list of people is available through the getDirectRecipients()
 
213
question.  This list of people is available through the direct_recipients
214
214
method.
215
215
 
216
 
    >>> subscribers = firefox_question.getDirectRecipients()
 
216
    >>> subscribers = firefox_question.direct_recipients
217
217
 
218
218
That method returns an INotificationRecipientSet, containing the direct
219
219
subscribers along with the rationale for contacting them.
227
227
    ...         text, header = subscribers.getReason(person)
228
228
    ...         print header, person.displayname, text
229
229
    >>> print_reason(subscribers)
230
 
    Subscriber Sample Person You received this question notification
231
 
    because you are a direct subscriber of the question.
 
230
    Asker Sample Person
 
231
    You received this question notification because you asked the question.
232
232
 
233
233
There is also a list of 'indirect' subscribers to the question.  These are
234
234
people that didn't explicitly subscribe to the question, but that will receive
236
236
part of the indirect subscribers list.
237
237
 
238
238
    # There are no answer contacts on the firefox product.
239
 
    >>> list(firefox_question.getIndirectRecipients())
 
239
    >>> list(firefox_question.indirect_recipients)
240
240
    []
241
241
 
242
242
    >>> from lp.services.worlddata.interfaces.language import ILanguageSet
245
245
    >>> firefox.addAnswerContact(no_priv)
246
246
    True
247
247
 
248
 
    >>> indirect_subscribers = firefox_question.getIndirectRecipients()
 
248
    >>> from lp.services.propertycache import get_property_cache
 
249
    >>> del get_property_cache(firefox_question).indirect_recipients
 
250
    >>> indirect_subscribers = firefox_question.indirect_recipients
249
251
    >>> verifyObject(INotificationRecipientSet, indirect_subscribers)
250
252
    True
251
253
    >>> print_reason(indirect_subscribers)
276
278
    >>> print_subscribers(package_question)
277
279
    Sample Person
278
280
 
279
 
    >>> indirect_subscribers = package_question.getIndirectRecipients()
 
281
    >>> del get_property_cache(firefox_question).indirect_recipients
 
282
    >>> indirect_subscribers = package_question.indirect_recipients
280
283
    >>> for person in indirect_subscribers:
281
284
    ...     print person.displayname
282
285
    No Privileges Person
292
295
 
293
296
    >>> login('admin@canonical.com')
294
297
    >>> package_question.assignee = getUtility(IPersonSet).getByName('name16')
295
 
    >>> indirect_subscribers = package_question.getIndirectRecipients()
 
298
    >>> del get_property_cache(package_question).indirect_recipients
 
299
    >>> indirect_subscribers = package_question.indirect_recipients
296
300
    >>> for person in indirect_subscribers:
297
301
    ...     print person.displayname
298
302
    Foo Bar
306
310
    You received this question notification because you are the assignee for
307
311
    this question.
308
312
 
309
 
The getIndirectSubscribers() method iterates like the getIndirectRecipients()
 
313
The getIndirectSubscribers() method iterates like the indirect_recipients
310
314
method, but it returns a sorted list instead of a NotificationRecipientSet.
311
315
It too contains the question assignee.
312
316