Skip to content
This repository has been archived by the owner on Mar 15, 2018. It is now read-only.

Commit

Permalink
remove transform special-cases since they make us slower overal
Browse files Browse the repository at this point in the history
Smaller objects do not significantly affect fast pages but tend to destroy
slower pages that need the fat objects.

http://jbalogh.khan.mozilla.org/xxx/#12-07
  • Loading branch information
Jeff Balogh committed Dec 8, 2010
1 parent 5de46bf commit 0872a64
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
3 changes: 1 addition & 2 deletions apps/addons/models.py
Expand Up @@ -427,8 +427,7 @@ def authors_other_addons(self):
"""
Return other addons by the author(s) of this addon
"""
return (Addon.objects.valid().only_translations()
.exclude(id=self.id)
return (Addon.objects.valid().exclude(id=self.id)
.filter(addonuser__listed=True,
authors__in=self.listed_authors).distinct())

Expand Down
2 changes: 1 addition & 1 deletion apps/addons/views.py
Expand Up @@ -109,7 +109,7 @@ def extension_detail(request, addon):
tags = addon.tags.not_blacklisted()

# addon recommendations
recommended = Addon.objects.valid().only_translations().filter(
recommended = Addon.objects.valid().filter(
recommended_for__addon=addon)[:5]

# popular collections this addon is part of
Expand Down
3 changes: 1 addition & 2 deletions apps/users/views.py
Expand Up @@ -324,8 +324,7 @@ def profile(request, user_id):
def get_addons(reviews):
if not reviews:
return
qs = (Addon.objects.all().only_translations()
.filter(id__in=set(r.addon_id for r in reviews)))
qs = Addon.objects.filter(id__in=set(r.addon_id for r in reviews))
addons = dict((addon.id, addon) for addon in qs)
for review in reviews:
review.addon = addons.get(review.addon_id)
Expand Down
5 changes: 2 additions & 3 deletions apps/versions/views.py
Expand Up @@ -56,8 +56,7 @@ def _find_version_page(qs, addon_id, version_num):
# Should accept junk at the end for filename goodness.
def download_file(request, file_id, type=None):
file = get_object_or_404(File.objects, pk=file_id)
addon = get_object_or_404(Addon.objects.all().no_transforms(),
pk=file.version.addon_id)
addon = get_object_or_404(Addon.objects, pk=file.version.addon_id)

if (addon.status == amo.STATUS_DISABLED
and not acl.check_ownership(request, addon)):
Expand Down Expand Up @@ -85,7 +84,7 @@ def download_file(request, file_id, type=None):


def download_latest(request, addon_id, type='xpi', platform=None):
addon = get_object_or_404(Addon.objects.all().no_transforms(),
addon = get_object_or_404(Addon.objects,
pk=addon_id, _current_version__isnull=False)
platforms = [amo.PLATFORM_ALL.id]
if platform is not None and int(platform) in amo.PLATFORMS:
Expand Down

0 comments on commit 0872a64

Please sign in to comment.