def get_anonymous_profile(self): """Return a random anonymous profile object""" profile = Profile() profile.is_authenticated = False while True: #random id of a visitor is set in the http bootstrapping call, and transferred using the session object username = '******' % self.transport.session['id'] if not HWIOS.ws_realm.pool.name_taken(username): profile.username = username profile.id = self.transport.session['id'] try: profile.uuid = uuid.uuid5(uuid.NAMESPACE_DNS, str(self.session_id)) except AttributeError: profile.uuid = uuid.uuid5(uuid.NAMESPACE_DNS, self.transport.getPeer().host) break else: self.transport.session['id'] = random.randint(1000,9999) self.get_anonymous_profile() return profile