← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1248230] Re: Replace cached method calls with @memoized_method

 

** Changed in: horizon
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Dashboard (Horizon).
https://bugs.launchpad.net/bugs/1248230

Title:
  Replace cached method calls with @memoized_method

Status in OpenStack Dashboard (Horizon):
  Fix Released

Bug description:
  There is a certain pattern repeated all over openstack_dashboard for
  caching results of method calls. It looks something like this:

      def get_data(self):
          if not hasattr(self, "_data"):
              # Calculate data here.
              self._data = data
          return self._data

  This repeating pattern is an example of copy-and-paste programming and
  can be instead easily abstracted away into a decorator. This way all
  the logic is in one place and all the code benefits from bugfixes and
  performance improvement of that code.

To manage notifications about this bug go to:
https://bugs.launchpad.net/horizon/+bug/1248230/+subscriptions