Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env python
#coding=utf8
class CCClient(object):
'''
Represent a single client connected to the server.
'''
def __init__(self, login, role, server, connection):
# The login of the client:
self._login = login
# The role of the client:
self._role = role
# The server binded to this client:
self._server = server
# The connection of the client (public attribute):
self.connection = connection
def get_tags(self, tags=None):
'''
Get the tags of the object.
:param tags: the list of tags to fetch, or None for all
'''
# Get the tags from the server
tags = self.connection.call('get_tags', tags)
# Add the static tags:
tags['a'] = self._login
tags['hv'] = self._login
tags['role'] = self._role
# Update it with the locally defined tags:
tags.update(self._server.conf.show(self._login)['tags'])
return tags