← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1668262] [NEW] update callback subscriptions of object methods to use decorator

 

Public bug reported:

We can now use @registry.recieves("resource", ["event1", "event2"]) to
decorate methods in a class that should be subscribed to the callback
manager when its instances are created.

This improves readability for two purposes:

1. Using the decorator right above the method makes it easy to see when looking at the code when the method is going to be called instead of having to search for the component that subscribes it.
2. We can stop overriding __new__ in class definitions just for registry subscriptions, which makes the class definitions a little cleaner.


See https://review.openstack.org/#/c/438489/ and https://review.openstack.org/#/c/436353/ for examples.

** Affects: neutron
     Importance: Low
         Status: Confirmed


** Tags: low-hanging-fruit

** Changed in: neutron
       Status: New => Confirmed

** Changed in: neutron
   Importance: Undecided => Low

** Tags added: low-hanging-fruit

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1668262

Title:
  update callback subscriptions of object methods to use decorator

Status in neutron:
  Confirmed

Bug description:
  We can now use @registry.recieves("resource", ["event1", "event2"]) to
  decorate methods in a class that should be subscribed to the callback
  manager when its instances are created.

  This improves readability for two purposes:

  1. Using the decorator right above the method makes it easy to see when looking at the code when the method is going to be called instead of having to search for the component that subscribes it.
  2. We can stop overriding __new__ in class definitions just for registry subscriptions, which makes the class definitions a little cleaner.

  
  See https://review.openstack.org/#/c/438489/ and https://review.openstack.org/#/c/436353/ for examples.

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


Follow ups