36
37
>>> filebug_view = create_view(ubuntu_firefox, LaunchpadTestRequest())
37
38
>>> filebug_view.validate(bug_data) is None
39
41
>>> filebug_view.submit_bug_action.success(bug_data)
40
42
>>> filebug_view.added_bug.title
42
45
>>> filebug_view.added_bug.description
43
46
u'Test description.'
46
== URLs to additional FileBug elements ==
49
URLs to additional FileBug elements
50
-----------------------------------
48
52
FileBugViewBase's inline_filebug_base_url returns the base URL for all
49
53
inline +filebug work.
90
94
http://launchpad.dev/evolution/+filebug-show-similar
93
== Adding extra info to filed bugs ==
97
Adding extra info to filed bugs
98
-------------------------------
95
100
It's possible for bug reporting tools to upload a file with debug
96
101
information to Launchpad, and pass that information to the filebug page.
114
121
... Content-disposition: inline
115
122
... Content-type: text/plain; charset=utf-8
117
124
... This should be added to the description.
122
128
>>> import transaction
123
129
>>> from canonical.launchpad.interfaces.temporaryblobstorage import ITemporaryStorageManager
124
130
>>> token = getUtility(ITemporaryStorageManager).new(debug_data)
143
149
... job.job.complete()
144
150
>>> process_blob(token)
146
Now, if we pass the token to the filebug view, the extra_data
147
attribute will be set with the actual data.
152
Now, if we pass the token to the filebug view, the extra_data attribute
153
will be set with the actual data.
149
155
>>> filebug_view = create_initialized_view(ubuntu_firefox, '+filebug')
150
156
>>> filebug_view.publishTraverse(
184
193
... Content-disposition: inline
185
194
... Content-type: text/plain; charset=utf-8
187
196
... This should be added to the description.
190
199
... Content-disposition: inline
191
200
... Content-type: text/plain; charset=utf-8
193
202
... This should be added as a comment.
196
205
... Content-disposition: inline
197
206
... Content-type: text/plain; charset=utf-8
199
208
... This should be added as another comment.
208
217
>>> filebug_view.publishTraverse(filebug_view.request,
209
218
... token) is filebug_view
211
221
>>> filebug_view.validate(bug_data) is None
213
224
>>> filebug_view.submit_bug_action.success(bug_data)
215
226
>>> filebug_view.added_bug.title
217
229
>>> print filebug_view.added_bug.description #doctest: -NORMALIZE_WHITESPACE
218
230
Test description.
235
247
A comment with additional information was added to the bug report.
240
All the parts that have a 'Content-disposition: attachment' header
241
will get added as attachments to the bug. The attachment description can
242
be specified using a Content-description header, but it's not required.
253
All the parts that have a 'Content-disposition: attachment' header will
254
get added as attachments to the bug. The attachment description can be
255
specified using a Content-description header, but it's not required.
244
257
>>> debug_data = """MIME-Version: 1.0
245
258
... Content-type: multipart/mixed; boundary=boundary
248
261
... Content-disposition: attachment; filename='attachment1'
249
262
... Content-type: text/plain; charset=utf-8
251
264
... This is an attachment.
254
267
... Content-disposition: attachment; filename='attachment2'
255
268
... Content-description: Attachment description.
256
269
... Content-type: text/plain; charset=ISO-8859-1
258
271
... This is another attachment, with a description.
267
280
>>> filebug_view.publishTraverse(filebug_view.request,
268
281
... token) is filebug_view
270
284
>>> filebug_view.validate(bug_data) is None
272
287
>>> filebug_view.submit_bug_action.success(bug_data)
274
289
Since the attachments are stored in the Librarian, we need to commit the
319
335
Comment by No Privileges Person: 2 attachment(s)
324
We can specify whether a bug is private by providing Private field in the
341
We can specify whether a bug is private by providing Private field in
327
344
>>> debug_data = """MIME-Version: 1.0
328
345
... Content-type: multipart/mixed; boundary=boundary
344
361
>>> filebug_view.publishTraverse(filebug_view.request,
345
362
... token) is filebug_view
347
365
>>> filebug_view.extra_data.extra_description
348
366
u'This bug should be private.'
349
368
>>> filebug_view.extra_data.private
352
371
>>> filebug_view.validate(bug_data) is None
354
374
>>> filebug_view.submit_bug_action.success(bug_data)
355
375
>>> filebug_view.added_bug.title
357
378
>>> print filebug_view.added_bug.description #doctest: -NORMALIZE_WHITESPACE
358
379
Test description.
360
381
This bug should be private.
361
383
>>> filebug_view.added_bug.private
363
386
>>> filebug_view.added_bug.security_related
366
Since the bug was marked private before it was filed, only the bug reporter has
367
been subscribed to the bug and there should be no indirect subscribers.
389
Since the bug was marked private before it was filed, only the bug
390
reporter has been subscribed to the bug and there should be no indirect
369
393
>>> for subscriber in filebug_view.added_bug.getDirectSubscribers():
370
394
... print subscriber.displayname
400
424
>>> filebug_view.publishTraverse(filebug_view.request,
401
425
... token) is filebug_view
403
428
>>> filebug_view.extra_data.extra_description
404
429
u'This bug should be public.'
405
431
>>> filebug_view.extra_data.private
408
434
>>> filebug_view.validate(bug_data) is None
410
437
>>> filebug_view.submit_bug_action.success(bug_data)
411
438
>>> filebug_view.added_bug.title
413
441
>>> print filebug_view.added_bug.description #doctest: -NORMALIZE_WHITESPACE
414
442
Test description.
416
444
This bug should be public.
417
446
>>> filebug_view.added_bug.private
420
Since this bug is public, both the reporter and the bug supervisor have been
449
Since this bug is public, both the reporter and the bug supervisor have
423
452
>>> for subscriber in filebug_view.added_bug.getDirectSubscribers():
424
453
... print subscriber.displayname
433
=== Subscriptions ===
435
We can also subscribe someone to this bug when we file it by using a Subscribe
436
field in the message. Multiple people can be specified and they can be
437
identified by their Launchpad name or their e-mail address.
465
We can also subscribe someone to this bug when we file it by using a
466
Subscribe field in the message. Multiple people can be specified and
467
they can be identified by their Launchpad name or their e-mail address.
439
469
>>> debug_data = """MIME-Version: 1.0
440
470
... Content-type: multipart/mixed; boundary=boundary
495
527
Sample Person has been subscribed to this bug.
498
=== Subscribers to Private bugs ===
530
Subscribers to Private bugs
531
...........................
500
The Private and Subscriber fields are intended to be used together to subscribe
501
certain people and teams to bugs when they are filed.
533
The Private and Subscriber fields are intended to be used together to
534
subscribe certain people and teams to bugs when they are filed.
503
536
>>> debug_data = """MIME-Version: 1.0
504
537
... Content-type: multipart/mixed; boundary=boundary
547
580
>>> filebug_view.added_bug.private
549
583
>>> filebug_view.added_bug.security_related
552
As well as the reporter, Mark Shuttleworth should have been subscribed to the
586
As well as the reporter, Mark Shuttleworth should have been subscribed
555
589
>>> for subscriber in filebug_view.added_bug.getDirectSubscribers():
556
590
... print subscriber.displayname
562
596
>>> filebug_view.added_bug.getIndirectSubscribers()
565
The user will be notified that Mark Shuttleworth has been subscribed to this
566
bug and that the bug has been marked as private.
599
The user will be notified that Mark Shuttleworth has been subscribed to
600
this bug and that the bug has been marked as private.
568
602
>>> for notification in filebug_view.request.response.notifications:
569
603
... print notification.message
623
662
>>> filebug_view = create_initialized_view(ubuntu_firefox, '+filebug')
624
663
>>> filebug_view.validate(bug_data) is None
626
666
>>> filebug_view.submit_bug_action.success(bug_data)
627
667
>>> filebug_view.added_bug.title
629
670
>>> filebug_view.added_bug.description
630
671
u'Test description.'
631
673
>>> for tag in filebug_view.added_bug.tags:
637
== Filing security bugs ==
639
682
The base class allows security bugs to be filed.
645
688
>>> filebug_view = create_initialized_view(ubuntu_firefox, '+filebug')
646
689
>>> filebug_view.validate(bug_data) is None
648
692
>>> filebug_view.submit_bug_action.success(bug_data)
649
693
>>> filebug_view.added_bug.title
651
696
>>> filebug_view.added_bug.security_related
655
== Extra fields for bug supervisors ==
700
Extra fields for bug supervisors
701
--------------------------------
657
703
Bug supervisors are offered several extra options when filing bugs.
692
738
... milestone=milestone, status=BugTaskStatus.TRIAGED)
693
739
>>> print filebug_view.validate(bug_data)
695
742
>>> filebug_view.submit_bug_action.success(bug_data)
696
743
>>> [added_bugtask] = filebug_view.added_bug.bugtasks
698
745
>>> print added_bugtask.status.title
700
748
>>> print added_bugtask.importance.title
702
751
>>> print added_bugtask.assignee.name
704
754
>>> print added_bugtask.milestone.name
705
755
bug-superdude-milestone
711
=== The comment field ===
713
When filing a bug, supplying an empty comment causes a validation error:
715
>>> from lp.bugs.browser.bugtarget import FileBugGuidedView
716
>>> request = LaunchpadTestRequest(
717
... form={'field.actions.submit_bug': 'Submit Bug Request'})
718
>>> filebug_view = FileBugGuidedView(ubuntu, request)
719
>>> filebug_view.submit_bug_action.submitted()
721
>>> bug_data = dict(title='Test Title', comment='')
722
>>> filebug_view.setUpFields()
723
>>> filebug_view.setUpWidgets()
724
>>> filebug_view.validate(bug_data)
725
>>> print filebug_view.getFieldError('comment')
726
Required input is missing.
728
Comments can be up to 50000 characters in length:
730
>>> comment = 'x' * 50000
731
>>> bug_data = dict(title='Test Title', comment=comment)
732
>>> filebug_view = FileBugGuidedView(ubuntu, request)
733
>>> filebug_view.setUpFields()
734
>>> filebug_view.setUpWidgets()
735
>>> filebug_view.validate(bug_data)
736
>>> print filebug_view.getFieldError('comment')
739
Supplying a comment that is too long causes a validation error:
741
>>> comment = 'x' * 50001
742
>>> bug_data = dict(title='Test Title', comment=comment)
743
>>> filebug_view = FileBugGuidedView(ubuntu, request)
744
>>> filebug_view.setUpFields()
745
>>> filebug_view.setUpWidgets()
746
>>> filebug_view.validate(bug_data)
747
>>> print filebug_view.getFieldError('comment')
748
The description is too long...