Revision 3fa01ebd snf-cyclades-app/synnefo/management/common.py
b/snf-cyclades-app/synnefo/management/common.py | ||
---|---|---|
263 | 263 |
|
264 | 264 |
|
265 | 265 |
class UUIDCache(object): |
266 |
"""UUUID-to-email cache |
|
267 |
|
|
268 |
""" |
|
269 |
|
|
270 |
astakos_url = ASTAKOS_URL.replace("im/authenticate", |
|
271 |
"service/api/user_catalogs") |
|
272 |
|
|
266 | 273 |
def __init__(self): |
267 | 274 |
self.users = {} |
268 | 275 |
|
269 | 276 |
def get_user(self, uuid): |
277 |
"""Do the uuid-to-email resolving |
|
278 |
""" |
|
279 |
|
|
270 | 280 |
if not uuid in self.users: |
271 |
astakos_url = ASTAKOS_URL.replace("im/authenticate", |
|
272 |
"service/api/user_catalogs") |
|
273 |
self.users[uuid] = \ |
|
274 |
astakos.get_displayname(token=CYCLADES_ASTAKOS_SERVICE_TOKEN, |
|
275 |
url=astakos_url, uuid=uuid) |
|
281 |
try: |
|
282 |
self.users[uuid] = \ |
|
283 |
astakos.get_displayname(token=CYCLADES_ASTAKOS_SERVICE_TOKEN, |
|
284 |
url=UUIDCache.astakos_url, uuid=uuid) |
|
285 |
except Exception: |
|
286 |
return uuid |
|
276 | 287 |
|
277 | 288 |
return self.users[uuid] |
Also available in: Unified diff