launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #11828
[Merge] lp:~stevenk/launchpad/dsp-changelog-timeout into lp:launchpad
Steve Kowalik has proposed merging lp:~stevenk/launchpad/dsp-changelog-timeout into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #1008312 in Launchpad itself: "DistributionSourcePackage:+changelog times out"
https://bugs.launchpad.net/launchpad/+bug/1008312
For more details, see:
https://code.launchpad.net/~stevenk/launchpad/dsp-changelog-timeout/+merge/123880
Destroy the bug pre-loading in DistributionSourcePackage:+changelog. For busy packages this would end up bringing in huge numbers of bugs that we don't need to since we linkify them anyway.
Clean up stringformatter, since it was a *mess*.
--
https://code.launchpad.net/~stevenk/launchpad/dsp-changelog-timeout/+merge/123880
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/dsp-changelog-timeout into lp:launchpad.
=== modified file 'lib/lp/app/browser/stringformatter.py'
--- lib/lp/app/browser/stringformatter.py 2012-07-09 14:10:11 +0000
+++ lib/lp/app/browser/stringformatter.py 2012-09-12 04:33:21 +0000
@@ -1,9 +1,7 @@
-# Copyright 2010-2011 Canonical Ltd. This software is licensed under the
+# Copyright 2010-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""TALES formatter for strings."""
-from base64 import urlsafe_b64encode
-
__metaclass__ = type
__all__ = [
@@ -18,12 +16,13 @@
'split_paragraphs',
]
+from base64 import urlsafe_b64encode
import cgi
import re
+from xml.sax.saxutils import unescape as xml_unescape
+
from lxml import html
-from xml.sax.saxutils import unescape as xml_unescape
import markdown
-
from zope.component import getUtility
from zope.interface import implements
from zope.traversing.interfaces import (
@@ -31,18 +30,16 @@
TraversalError,
)
-from lp.services.config import config
-from lp.services.webapp import canonical_url
-from lp.services.webapp.interfaces import ILaunchBag
from lp.answers.interfaces.faq import IFAQSet
from lp.registry.interfaces.person import IPersonSet
+from lp.services.config import config
+from lp.services.features import getFeatureFlag
from lp.services.utils import (
+ obfuscate_email,
re_email_address,
- obfuscate_email,
- )
-from lp.services.features import (
- getFeatureFlag,
- )
+ )
+from lp.services.webapp import canonical_url
+from lp.services.webapp.interfaces import ILaunchBag
def escape(text, quote=True):
=== modified file 'lib/lp/registry/browser/distributionsourcepackage.py'
--- lib/lp/registry/browser/distributionsourcepackage.py 2012-08-09 16:39:41 +0000
+++ lib/lp/registry/browser/distributionsourcepackage.py 2012-09-12 04:33:21 +0000
@@ -41,10 +41,7 @@
action,
LaunchpadEditFormView,
)
-from lp.app.browser.stringformatter import (
- extract_bug_numbers,
- extract_email_addresses,
- )
+from lp.app.browser.stringformatter import extract_email_addresses
from lp.app.browser.tales import CustomizableFormatter
from lp.app.enums import ServiceUsage
from lp.app.interfaces.launchpad import IServiceUsage
@@ -54,7 +51,6 @@
StructuralSubscriptionMenuMixin,
StructuralSubscriptionTargetTraversalMixin,
)
-from lp.bugs.interfaces.bug import IBugSet
from lp.bugs.interfaces.bugtask import BugTaskStatus
from lp.bugs.interfaces.bugtasksearch import BugTaskSearchParams
from lp.registry.browser import add_subscribe_link
@@ -290,20 +286,12 @@
return []
sprs = [dspr.sourcepackagerelease for (dspr, spphs) in dspr_pubs]
- # Pre-load the bugs and persons referenced by the +changelog page from
- # the database.
- # This will improve the performance of the ensuing changelog
- # linkification.
+ # Preload email/person data only if user is logged on. In the opposite
+ # case the emails in the changelog will be obfuscated anyway and thus
+ # cause no database lookups.
the_changelog = '\n'.join(
[spr.changelog_entry for spr in sprs
if not_empty(spr.changelog_entry)])
- unique_bugs = extract_bug_numbers(the_changelog)
- self._bug_data = list(
- getUtility(IBugSet).getByNumbers(
- [int(key) for key in unique_bugs.keys()]))
- # Preload email/person data only if user is logged on. In the opposite
- # case the emails in the changelog will be obfuscated anyway and thus
- # cause no database lookups.
if self.user:
self._person_data = dict(
[(email.email, person) for (email, person) in
Follow ups