~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/registry/browser/announcement.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-09-26 16:35:37 UTC
  • mfrom: (13995.1.6 add-longpoll)
  • Revision ID: launchpad@pqm.canonical.com-20110926163537-o17y6ic6g9i3g943
[r=julian-edwards][no-qa] Upgrade txlongpoll version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
155
155
    def announce_action(self, action, data):
156
156
        """Registers a new announcement."""
157
157
        self.context.announce(
158
 
            user=self.user,
159
 
            title=data.get('title'),
160
 
            summary=data.get('summary'),
161
 
            url=data.get('url'),
162
 
            publication_date=data.get('publication_date'))
 
158
            user = self.user,
 
159
            title = data.get('title'),
 
160
            summary = data.get('summary'),
 
161
            url = data.get('url'),
 
162
            publication_date = data.get('publication_date')
 
163
            )
163
164
        self.next_url = canonical_url(self.context)
164
165
 
165
166
    @property
192
193
        self.context.modify(title=data.get('title'),
193
194
                            summary=data.get('summary'),
194
195
                            url=data.get('url'))
195
 
        self.next_url = canonical_url(self.context.target) + '/+announcements'
 
196
        self.next_url = canonical_url(self.context.target)+'/+announcements'
196
197
 
197
198
 
198
199
class AnnouncementRetargetForm(Interface):
236
237
    def retarget_action(self, action, data):
237
238
        target = data.get('target')
238
239
        self.context.retarget(target)
239
 
        self.next_url = canonical_url(self.context.target) + '/+announcements'
 
240
        self.next_url = canonical_url(self.context.target)+'/+announcements'
240
241
 
241
242
 
242
243
class AnnouncementPublishView(AnnouncementFormMixin, LaunchpadFormView):
252
253
    def publish_action(self, action, data):
253
254
        publication_date = data['publication_date']
254
255
        self.context.setPublicationDate(publication_date)
255
 
        self.next_url = canonical_url(self.context.target) + '/+announcements'
 
256
        self.next_url = canonical_url(self.context.target)+'/+announcements'
256
257
 
257
258
 
258
259
class AnnouncementRetractView(AnnouncementFormMixin, LaunchpadFormView):
264
265
    @action(_('Retract'), name='retract')
265
266
    def retract_action(self, action, data):
266
267
        self.context.retract()
267
 
        self.next_url = canonical_url(self.context.target) + '/+announcements'
 
268
        self.next_url = canonical_url(self.context.target)+'/+announcements'
268
269
 
269
270
 
270
271
class AnnouncementDeleteView(AnnouncementFormMixin, LaunchpadFormView):
276
277
    @action(_("Delete"), name="delete", validator='validate_cancel')
277
278
    def action_delete(self, action, data):
278
279
        self.context.destroySelf()
279
 
        self.next_url = canonical_url(self.context.target) + '/+announcements'
 
280
        self.next_url = canonical_url(self.context.target)+'/+announcements'
280
281
 
281
282
 
282
283
class HasAnnouncementsView(LaunchpadView, FeedsMixin):
293
294
        elif RootAnnouncementsFeedLink.usedfor.providedBy(self.context):
294
295
            return RootAnnouncementsFeedLink(self.context).href
295
296
        else:
296
 
            raise AssertionError("Unknown feed source")
 
297
            raise AssertionError, 'Unknown feed source'
297
298
 
298
299
    @cachedproperty
299
300
    def announcements(self):