WIP: integration of the Attract addon into the Blender Cloud adddon.

This commit is contained in:
2016-08-01 14:40:56 +02:00
parent 63b976cb44
commit c57da7ab2b
4 changed files with 498 additions and 2 deletions

View File

@@ -198,6 +198,12 @@ pillar_semaphore = asyncio.Semaphore(3)
async def pillar_call(pillar_func, *args, caching=True, **kwargs):
"""Calls a Pillar function.
A semaphore is used to ensure that there won't be too many
calls to Pillar simultaneously.
"""
partial = functools.partial(pillar_func, *args, api=pillar_api(caching=caching), **kwargs)
loop = asyncio.get_event_loop()
@@ -205,6 +211,12 @@ async def pillar_call(pillar_func, *args, caching=True, **kwargs):
return await loop.run_in_executor(None, partial)
def call(pillar_func, *args, **kwargs):
"""Synchronous call to Pillar, ensures the correct Api object is used."""
return pillar_func(*args, api=pillar_api(), **kwargs)
async def check_pillar_credentials(required_roles: set):
"""Tries to obtain the user at Pillar using the user's credentials.