Skip to content

Add parameter to pass in a list of Role names for use in export#295

Open
tim-d-blue wants to merge 4 commits into
schematics:masterfrom
tim-d-blue:multi_roles
Open

Add parameter to pass in a list of Role names for use in export#295
tim-d-blue wants to merge 4 commits into
schematics:masterfrom
tim-d-blue:multi_roles

Conversation

@tim-d-blue

Copy link
Copy Markdown

This provides a simpler method to combine multiple roles on export. Given a simple list of roles, when export is called a list of roles can be provided and the export will combine the roles and filter fields appropriately. Therefore dynamic role combination is available. Blacklist roles will override whitelist roles.

@bintoro

bintoro commented Oct 31, 2015

Copy link
Copy Markdown
Member

I like the idea, but couldn't we repurpose the existing role parameter instead of introducing a parallel parameter roles?

Something like:

if isinstance(role, Role):
    role = (role,)

and then the rest of the code could just assume it's an iterable of roles.

Btw, the __name__ attribute on functions has been around at least since Python 2.5, so I'm thinking this whole thing:

if role and ((hasattr(role.function, "func_name") and
              role.function.func_name == "whitelist")
             or (hasattr(role.function, "__name__") and
                 role.function.__name__ == "whitelist")):

can probably be simplified to:

if role and role.function.__name__ == "whitelist"

@bintoro bintoro force-pushed the development branch 4 times, most recently from cc96316 to 26ae9f6 Compare November 4, 2015 03:41
@berislavlopac

Copy link
Copy Markdown

Any updates on this PR?

@lkraider lkraider closed this May 23, 2017
@lkraider lkraider reopened this May 23, 2017
@lkraider lkraider changed the base branch from development to master May 31, 2017 02:09
@lkraider

lkraider commented Mar 3, 2018

Copy link
Copy Markdown
Contributor

Needs to be refactored according to suggestions before pulling it in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants