def _cb(result): if result == False: raise ReservationError( "UID %s is not reserved for address book collection %s." % (uid, self.index.resource)) else: try: self.index._db_execute( "delete from RESERVED where UID = :1", uid) self.index._db_commit() except sqlite.Error, e: log.error("Unable to unreserve UID: %s", (e, )) self.index._db_rollback() raise
def reserveUID(self, uid): """ Reserve a UID for this index's resource. @param uid: the UID to reserve @raise ReservationError: if C{uid} is already reserved """ try: self.index._db_execute("insert into RESERVED (UID, TIME) values (:1, :2)", uid, datetime.datetime.now()) self.index._db_commit() except sqlite.IntegrityError: self.index._db_rollback() raise ReservationError( "UID %s already reserved for address book collection %s." % (uid, self.index.resource) ) except sqlite.Error, e: log.error("Unable to reserve UID: {ex}", ex=e) self.index._db_rollback() raise
def _handleFalse(result): if result is False: raise ReservationError( "UID %s already reserved for address book collection %s." % (uid, self.index.resource) )
def _handleFalse(result): if result is False: raise ReservationError( "UID %s is not reserved for calendar collection %s." % (uid, self.index.resource))