コード例 #1
0
 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
コード例 #2
0
    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
コード例 #3
0
 def _handleFalse(result):
     if result is False:
         raise ReservationError(
             "UID %s already reserved for address book collection %s."
             % (uid, self.index.resource)
         )
コード例 #4
0
 def _handleFalse(result):
     if result is False:
         raise ReservationError(
             "UID %s is not reserved for calendar collection %s." %
             (uid, self.index.resource))