Ejemplo n.º 1
0
    def __init__(self, name=None, **kwargs):
        mongo.MongoObject.__init__(self, **kwargs)
        self.user_count = None
        self.users_online = None
        self.usage = HostUsage(self.id)

        if name is not None:
            self.name = name

        if self.name is None:
            self.name = utils.random_name()
Ejemplo n.º 2
0
    def __init__(self, name=None, **kwargs):
        mongo.MongoObject.__init__(self, **kwargs)

        if 'id' not in kwargs and 'doc' not in kwargs and 'spec' not in kwargs:
            self.id = settings.local.host_id

        self.usage = HostUsage(self.id)

        if name is not None:
            self.name = name

        if self.name is None:
            self.name = utils.random_name()
Ejemplo n.º 3
0
 def usage(self):
     if not self._usage:
         self._usage = HostUsage(self.id)
     elif self._usage.host_id != self.id:
         self._usage = HostUsage(self.id)
     return self._usage