implement caching for get_hosting_package
This commit is contained in:
parent
832a611602
commit
5e1f34c9d8
2 changed files with 10 additions and 3 deletions
|
@ -1,6 +1,9 @@
|
||||||
Changelog
|
Changelog
|
||||||
=========
|
=========
|
||||||
|
|
||||||
|
* :support:`-` cache result of get_hosting_package method of
|
||||||
|
gvawebcore.views.HostingPackageAndCustomerMixin to improve page loading
|
||||||
|
performance
|
||||||
* :feature:`-` add ability to add, list and delete SSH public keys assigned to
|
* :feature:`-` add ability to add, list and delete SSH public keys assigned to
|
||||||
a hosting package's operating system user and change their comments
|
a hosting package's operating system user and change their comments
|
||||||
* :feature:`-` add ability to add SSH public keys for operating system users
|
* :feature:`-` add ability to add SSH public keys for operating system users
|
||||||
|
|
|
@ -17,10 +17,14 @@ class HostingPackageAndCustomerMixin(object):
|
||||||
hosting_package_kwarg = 'package'
|
hosting_package_kwarg = 'package'
|
||||||
"""Keyword argument used to find the hosting package in the URL."""
|
"""Keyword argument used to find the hosting package in the URL."""
|
||||||
|
|
||||||
|
hostingpackage = None
|
||||||
|
|
||||||
def get_hosting_package(self):
|
def get_hosting_package(self):
|
||||||
return get_object_or_404(
|
if self.hostingpackage is None:
|
||||||
CustomerHostingPackage,
|
self.hostingpackage = get_object_or_404(
|
||||||
pk=int(self.kwargs[self.hosting_package_kwarg]))
|
CustomerHostingPackage,
|
||||||
|
pk=int(self.kwargs[self.hosting_package_kwarg]))
|
||||||
|
return self.hostingpackage
|
||||||
|
|
||||||
def get_customer_object(self):
|
def get_customer_object(self):
|
||||||
return self.get_hosting_package().customer
|
return self.get_hosting_package().customer
|
||||||
|
|
Loading…
Reference in a new issue