Mercurial > code > home > repos > light9
comparison bin/rdfdb @ 1344:01f7ece0cb13
refactor rdfdb: Db doesn't make Client objects
Ignore-this: 205ebf0d96f84d12df5dd88798ad097e
author | Drew Perttula <drewp@bigasterisk.com> |
---|---|
date | Sun, 05 Jun 2016 00:43:21 +0000 |
parents | a214a9d6f2f0 |
children | 13f758eda3b4 |
comparison
equal
deleted
inserted
replaced
1343:a214a9d6f2f0 | 1344:01f7ece0cb13 |
---|---|
328 g = Graph() | 328 g = Graph() |
329 for s in self.graph.triples(ALLSTMTS, uri): | 329 for s in self.graph.triples(ALLSTMTS, uri): |
330 g.add(s) | 330 g.add(s) |
331 return g | 331 return g |
332 | 332 |
333 def addClient(self, updateUri, label): | 333 def addClient(self, newClient): |
334 [self.clients.remove(c) | 334 [self.clients.remove(c) |
335 for c in self.clients if c.updateUri == updateUri] | 335 for c in self.clients if c.updateUri == newClient.updateUri] |
336 | 336 |
337 log.info("new client %s at %s" % (label, updateUri)) | 337 log.info("new client %s at %s" % (newClient.label, newClient.updateUri)) |
338 c = Client(updateUri, label) | 338 newClient.sendAll(self.graph) |
339 c.sendAll(self.graph) | 339 self.clients.append(newClient) |
340 self.clients.append(c) | |
341 self.sendClientsToAllLivePages() | 340 self.sendClientsToAllLivePages() |
342 | 341 |
343 def sendClientsToAllLivePages(self): | 342 def sendClientsToAllLivePages(self): |
344 sendToLiveClients({"clients":[ | 343 sendToLiveClients({"clients":[ |
345 dict(updateUri=c.updateUri, label=c.label) | 344 dict(updateUri=c.updateUri, label=c.label) |
369 pass | 368 pass |
370 | 369 |
371 def post(self): | 370 def post(self): |
372 upd = self.get_argument("clientUpdate") | 371 upd = self.get_argument("clientUpdate") |
373 try: | 372 try: |
374 self.settings.db.addClient(upd, self.get_argument("label")) | 373 self.settings.db.addClient(Client(upd, self.get_argument("label"))) |
375 except: | 374 except: |
376 import traceback | 375 import traceback |
377 traceback.print_exc() | 376 traceback.print_exc() |
378 raise | 377 raise |
379 | 378 |