~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/blueprints/browser/sprint.py

  • Committer: Curtis Hovey
  • Date: 2011-08-12 14:39:51 UTC
  • mto: This revision was merged to the branch mainline in revision 13685.
  • Revision ID: curtis.hovey@canonical.com-20110812143951-74vfvrt37gtt4fz2
Sorted imports.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 
6
6
__metaclass__ = type
7
7
__all__ = [
8
 
    'HasSprintsView',
9
8
    'SprintAddView',
10
9
    'SprintAttendeesCsvExportView',
11
10
    'SprintBrandingView',
27
26
import csv
28
27
from StringIO import StringIO
29
28
 
30
 
from lazr.restful.utils import smartquote
31
29
import pytz
32
30
from zope.app.form.browser import TextAreaWidget
33
31
from zope.component import getUtility
34
32
from zope.interface import implements
35
33
 
36
 
from lp import _
 
34
from canonical.launchpad import _
 
35
from canonical.launchpad.helpers import shortlist
 
36
from canonical.launchpad.webapp import (
 
37
    canonical_url,
 
38
    enabled_with_permission,
 
39
    GetitemNavigation,
 
40
    LaunchpadView,
 
41
    Link,
 
42
    Navigation,
 
43
    NavigationMenu,
 
44
    StandardLaunchpadFacets,
 
45
    )
 
46
from canonical.launchpad.webapp.batching import BatchNavigator
 
47
from canonical.launchpad.webapp.breadcrumb import Breadcrumb
 
48
from canonical.lazr.utils import smartquote
37
49
from lp.app.browser.launchpadform import (
38
50
    action,
39
51
    custom_widget,
66
78
    )
67
79
from lp.registry.interfaces.person import IPersonSet
68
80
from lp.services.database.bulk import load_referencing
69
 
from lp.services.helpers import shortlist
70
81
from lp.services.propertycache import cachedproperty
71
 
from lp.services.webapp import (
72
 
    canonical_url,
73
 
    enabled_with_permission,
74
 
    GetitemNavigation,
75
 
    LaunchpadView,
76
 
    Link,
77
 
    Navigation,
78
 
    NavigationMenu,
79
 
    StandardLaunchpadFacets,
80
 
    )
81
 
from lp.services.webapp.batching import BatchNavigator
82
 
from lp.services.webapp.breadcrumb import Breadcrumb
83
82
 
84
83
 
85
84
class SprintFacets(StandardLaunchpadFacets):
165
164
    enable_only = ['overview', ]
166
165
 
167
166
 
168
 
class HasSprintsView(LaunchpadView):
169
 
 
170
 
    page_title = 'Events'
171
 
 
172
 
 
173
167
class SprintView(HasSpecificationsView):
174
168
 
175
169
    implements(IMajorHeadingView)
231
225
        return dt.strftime('%Y-%m-%d')
232
226
 
233
227
    _local_timeformat = '%H:%M %Z on %A, %Y-%m-%d'
234
 
 
235
228
    @property
236
229
    def local_start(self):
237
230
        """The sprint start time, in the local time zone, as text."""
383
376
        self.attendee_ids = set(
384
377
            attendance.attendeeID for attendance in self.context.attendances)
385
378
 
 
379
 
386
380
    @cachedproperty
387
381
    def spec_filter(self):
388
382
        """Return the specification links with PROPOSED status for this
406
400
        if 'SUBMIT_CANCEL' in form:
407
401
            self.status_message = 'Cancelled'
408
402
            self.request.response.redirect(
409
 
                canonical_url(self.context) + '/+specs')
 
403
                canonical_url(self.context)+'/+specs')
410
404
            return
411
405
 
412
406
        if 'SUBMIT_ACCEPT' not in form and 'SUBMIT_DECLINE' not in form:
445
439
        if leftover == 0:
446
440
            # they are all done, so redirect back to the spec listing page
447
441
            self.request.response.redirect(
448
 
                canonical_url(self.context) + '/+specs')
 
442
                canonical_url(self.context)+'/+specs')
449
443
 
450
444
 
451
445
class SprintMeetingExportView(LaunchpadView):
483
477
                model_specs, ['specificationID']):
484
478
            if subscription.personID not in attendee_set:
485
479
                continue
486
 
            people[subscription.specificationID][
487
 
                subscription.personID] = subscription.essential
488
 
 
489
 
        # Spec specials - drafter/assignee.  Don't need approver for
490
 
        # performance, as specifications() above eager-loaded the
491
 
        # people, and approvers don't count as "required persons."
 
480
            people[subscription.specificationID][subscription.personID] = \
 
481
                subscription.essential
 
482
        # Spec specials - drafter/assignee. Don't need approver for performance
 
483
        # as specifications() above eager loaded the people, and approvers
 
484
        # don't count as a 'required person'.
492
485
        for spec in model_specs:
493
 
            # Get the list of attendees that will attend the sprint.
 
486
            # get the list of attendees that will attend the sprint
494
487
            spec_people = people[spec.id]
495
488
            if spec.assigneeID is not None:
496
489
                spec_people[spec.assigneeID] = True
590
583
                 # We used to store phone, organization, city and
591
584
                 # country, but this was a lie because users could not
592
585
                 # update these fields.
593
 
                 '',  # attendance.attendee.phone
594
 
                 '',  # attendance.attendee.organization
595
 
                 '',  # attendance.attendee.city
596
 
                 '',  # country
 
586
                 '', # attendance.attendee.phone
 
587
                 '', # attendance.attendee.organization
 
588
                 '', # attendance.attendee.city
 
589
                 '', # country
597
590
                 time_zone,
598
591
                 attendance.time_starts.strftime('%Y-%m-%dT%H:%M:%SZ'),
599
592
                 attendance.time_ends.strftime('%Y-%m-%dT%H:%M:%SZ'),