Example #1
0
 def askObject(self, conn, oid, at, before):
     app = self.app
     if app.tm.loadLocked(oid):
         raise DelayEvent
     o = app.dm.getObject(oid, at, before)
     try:
         serial, next_serial, compression, checksum, data, data_serial = o
     except TypeError:
         p = (Errors.OidDoesNotExist if o is None else Errors.OidNotFound)(
             dump(oid))
     else:
         if checksum is None:
             checksum = ZERO_HASH
             data = ''
         p = Packets.AnswerObject(oid, serial, next_serial, compression,
                                  checksum, data, data_serial)
     conn.answer(p)
Example #2
0
 def askObject(self, conn, oid, serial, tid):
     app = self.app
     if app.tm.loadLocked(oid):
         # Delay the response.
         app.queueEvent(self.askObject, conn, (oid, serial, tid))
         return
     o = app.dm.getObject(oid, serial, tid)
     try:
         serial, next_serial, compression, checksum, data, data_serial = o
     except TypeError:
         p = (Errors.OidDoesNotExist if o is None else
              Errors.OidNotFound)(dump(oid))
     else:
         if checksum is None:
             checksum = ZERO_HASH
             data = ''
         p = Packets.AnswerObject(oid, serial, next_serial,
             compression, checksum, data, data_serial)
     conn.answer(p)