+ def initialize(self):
+ LaunchpadFormView.initialize(self)
+ if (not self.redirect_ubuntu_filebug and
+ self.extra_data_token is not None):
+ # self.extra_data has been initialized in publishTraverse().
+ if self.extra_data.initial_summary:
+ self.widgets['title'].setRenderedValue(
+ self.extra_data.initial_summary)
+ if self.extra_data.initial_tags:
+ self.widgets['tags'].setRenderedValue(
+ self.extra_data.initial_tags)
+ # XXX: Bjorn Tillenius 2006-01-15:
+ # We should include more details of what will be added
+ # to the bug report.
+ self.request.response.addNotification(
+ 'Extra debug information will be added to the bug report'
+ ' automatically.')
+
+ @cachedproperty
+ def redirect_ubuntu_filebug(self):
+ if IDistribution.providedBy(self.context):
+ bug_supervisor = self.context.bug_supervisor
+ elif (IDistributionSourcePackage.providedBy(self.context) or
+ ISourcePackage.providedBy(self.context)):
+ bug_supervisor = self.context.distribution.bug_supervisor
+
+ # Work out whether the redirect should be overidden.
+ do_not_redirect = (
+ self.request.form.get('no-redirect') is not None or
+ [key for key in self.request.form.keys()
+ if 'field.actions' in key] != [] or
+ self.user.inTeam(bug_supervisor))
+
+ return (
+ config.malone.ubuntu_disable_filebug and
+ self.targetIsUbuntu() and
+ self.extra_data_token is None and
+ not do_not_redirect)
def initialize(self):
- LaunchpadFormView.initialize(self)
-
- if (config.malone.ubuntu_disable_filebug and
- self.targetIsUbuntu() and
- self.extra_data_token is None and
- not self.no_ubuntu_redirect):
+ FilebugShowSimilarBugsView.initialize(self)
+ if self.redirect_ubuntu_filebug:
# The user is trying to file a new Ubuntu bug via the web
# interface and without using apport. Redirect to a page
# explaining the preferred bug-filing procedure. self.request.response.redirect( config.malone.ubuntu_bug_filing_url)
- if self.extra_data_token is not None:
- # self.extra_data has been initialized in publishTraverse().
- if self.extra_data.initial_summary:
- self.widgets['title'].setRenderedValue(
- self.extra_data.initial_summary)
- if self.extra_data.initial_tags:
- self.widgets['tags'].setRenderedValue(
- self.extra_data.initial_tags)
- # XXX: Bjorn Tillenius 2006-01-15:
- # We should include more details of what will be added
- # to the bug report.
- self.request.response.addNotification(
- 'Extra debug information will be added to the bug report'
- ' automatically.')
-
- @property
- def no_ubuntu_redirect(self):
- if IDistribution.providedBy(self.context):
- bug_supervisor = self.context.bug_supervisor
- elif (IDistributionSourcePackage.providedBy(self.context) or
- ISourcePackage.providedBy(self.context)):
- bug_supervisor = self.context.distribution.bug_supervisor
-
- return (
- self.request.form.get('no-redirect') is not None or
- [key for key in self.request.form.keys()
- if 'field.actions' in key] != [] or
- self.user.inTeam(bug_supervisor))
I had to do a slight refactor to make the fix that Gavin and I agreed on:
=== modified file 'lib/lp/ bugs/browser/ bugtarget. py' bugs/browser/ bugtarget. py 2009-12-16 08:13:19 +0000 bugs/browser/ bugtarget. py 2009-12-16 09:38:58 +0000
LaunchpadForm View.__ init__( self, context, request)
self. extra_data = FileBugData()
--- lib/lp/
+++ lib/lp/
@@ -270,6 +270,44 @@
+ def initialize(self): ew.initialize( self) ubuntu_ filebug and data_token is not None): data.initial_ summary: 'title' ].setRenderedVa lue( data.initial_ summary) data.initial_ tags: 'tags'] .setRenderedVal ue( data.initial_ tags) response. addNotification ( ubuntu_ filebug( self): providedBy( self.context) : bug_supervisor ourcePackage. providedBy( self.context) or providedBy( self.context) ): distribution. bug_supervisor form.get( 'no-redirect' ) is not None or form.keys( ) inTeam( bug_supervisor) ) malone. ubuntu_ disable_ filebug and untu() and data_token is None and
+ LaunchpadFormVi
+ if (not self.redirect_
+ self.extra_
+ # self.extra_data has been initialized in publishTraverse().
+ if self.extra_
+ self.widgets[
+ self.extra_
+ if self.extra_
+ self.widgets[
+ self.extra_
+ # XXX: Bjorn Tillenius 2006-01-15:
+ # We should include more details of what will be added
+ # to the bug report.
+ self.request.
+ 'Extra debug information will be added to the bug report'
+ ' automatically.')
+
+ @cachedproperty
+ def redirect_
+ if IDistribution.
+ bug_supervisor = self.context.
+ elif (IDistributionS
+ ISourcePackage.
+ bug_supervisor = self.context.
+
+ # Work out whether the redirect should be overidden.
+ do_not_redirect = (
+ self.request.
+ [key for key in self.request.
+ if 'field.actions' in key] != [] or
+ self.user.
+
+ return (
+ config.
+ self.targetIsUb
+ self.extra_
+ not do_not_redirect)
@property summary_ in_results = True
def field_names(self):
@@ -928,45 +966,13 @@
show_
def initialize(self): ew.initialize( self) malone. ubuntu_ disable_ filebug and untu() and data_token is None and ubuntu_ redirect) : larBugsView. initialize( self) ubuntu_ filebug:
self. request. response. redirect(
config. malone. ubuntu_ bug_filing_ url) data_token is not None: data.initial_ summary: 'title' ].setRenderedVa lue( data.initial_ summary) data.initial_ tags: 'tags'] .setRenderedVal ue( data.initial_ tags) response. addNotification ( redirect( self): providedBy( self.context) : bug_supervisor ourcePackage. providedBy( self.context) or providedBy( self.context) ): distribution. bug_supervisor form.get( 'no-redirect' ) is not None or form.keys( ) inTeam( bug_supervisor) )
- LaunchpadFormVi
-
- if (config.
- self.targetIsUb
- self.extra_
- not self.no_
+ FilebugShowSimi
+ if self.redirect_
# The user is trying to file a new Ubuntu bug via the web
# interface and without using apport. Redirect to a page
# explaining the preferred bug-filing procedure.
- if self.extra_
- # self.extra_data has been initialized in publishTraverse().
- if self.extra_
- self.widgets[
- self.extra_
- if self.extra_
- self.widgets[
- self.extra_
- # XXX: Bjorn Tillenius 2006-01-15:
- # We should include more details of what will be added
- # to the bug report.
- self.request.
- 'Extra debug information will be added to the bug report'
- ' automatically.')
-
- @property
- def no_ubuntu_
- if IDistribution.
- bug_supervisor = self.context.
- elif (IDistributionS
- ISourcePackage.
- bug_supervisor = self.context.
-
- return (
- self.request.
- [key for key in self.request.
- if 'field.actions' in key] != [] or
- self.user.
@safe_action "Continue" , name="search", validator= "validate_ search" )
@action(