← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1317238] [NEW] Duplicated get_policy_target() method across code

 

Public bug reported:

This chunk of code is copied all over the place:

def get_policy_target(self, request, datum=None):
    project_id = None
    if datum:
        project_id = getattr(datum, 'tenant_id', None)
    return {"project_id": project_id}

(Though sometimes with a different key in the return dict.)
Would it make more sense to create a mixin or update a super-class somewhere?

** Affects: horizon
     Importance: Undecided
         Status: New

-- 
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/1317238

Title:
  Duplicated get_policy_target() method across code

Status in OpenStack Dashboard (Horizon):
  New

Bug description:
  This chunk of code is copied all over the place:

  def get_policy_target(self, request, datum=None):
      project_id = None
      if datum:
          project_id = getattr(datum, 'tenant_id', None)
      return {"project_id": project_id}

  (Though sometimes with a different key in the return dict.)
  Would it make more sense to create a mixin or update a super-class somewhere?

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


Follow ups

References