def all(self): ret = [] hosts = Host.all() for host in hosts: ret.append(host) return ret
def add_host(self, ip, domain): if (len(ip) == 0 or len(domain) == 0): return updated = False hosts = db.GqlQuery("SELECT * FROM Host WHERE domain = :1 LIMIT 1", domain) for host in hosts: host.ip = ip try: db.put(host) updated = True except CapabilityDisabledError: return if (not updated): host = Host(ip = ip, domain = domain) try: host.put() except CapabilityDisabledError: pass return
def del_all(self): hosts = Host.all() for host in hosts: host.delete()
def count(self): count = 0 hosts = Host.all() count = hosts.count() return count