Commit e531d099 authored by Antoine Millet's avatar Antoine Millet

"con" tag management.

parent 857fbf59
......@@ -130,16 +130,15 @@ class CCServer(object):
if login in self._connected:
client = self._connected[login]
tags['con'] = client.get_uptime()
except Exception as err:
logging.error('Error while calling get_tags on '
'%s: %s' % (client.login, err))
tags['status'] = 'online'
tags['status'] = 'offline'
tags['con'] = 'offline'
# Apply all user specified tags:
#!/usr/bin/env python
from datetime import datetime
class CCClient(object):
Represent a single client connected to the server.
......@@ -20,20 +22,15 @@ class CCClient(object):
# The connection of the client (public attribute):
self.connection = connection
def get_tags(self, tags=None):
Get the tags of the object.
# The date of connection of the client:
self._connection_date =
:param tags: the list of tags to fetch, or None for all
def get_uptime(self):
Get the uptime of the client connection in seconds.
# Get the tags from the server
tags ='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:
return tags
:return: uptime of the client
dt = - self._connection_date
return dt.seconds + dt.days * 86400
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment