Example #1
0
 def clear_locks(self):
     """Clears any WebDAV locks on the adapted document left over by
     ExternalEditor.
     """
     lockable = IRefreshableLockable(self.context)
     if lockable and lockable.locked():
         lockable.clear_locks()
Example #2
0
 def clear_locks(self):
     """Clears any WebDAV locks on the adapted document left over by
     ExternalEditor.
     """
     lockable = IRefreshableLockable(self.context)
     if lockable and lockable.locked():
         lockable.clear_locks()
Example #3
0
 def is_locked(self):
     """Returns True if a user has a WebDAV lock on the adapted
     document, False otherwise.
     """
     lockable = IRefreshableLockable(self.context)
     # List of all users that hold a lock on the document
     if lockable and lockable.locked():
         return True
     return False
Example #4
0
 def is_locked(self):
     """Returns True if a user has a WebDAV lock on the adapted
     document, False otherwise.
     """
     lockable = IRefreshableLockable(self.context)
     # List of all users that hold a lock on the document
     if lockable and lockable.locked():
         return True
     return False
    def _migrate_checked_out_doc(self, doc, old_userid, new_userid):
        # Migrate "checked out by" information and reindex
        manager = getMultiAdapter((doc, self.portal.REQUEST),
                                  ICheckinCheckoutManager)
        key = CHECKIN_CHECKOUT_ANNOTATIONS_KEY
        if manager.annotations[key] == old_userid:
            manager.annotations[key] = new_userid
            logger.info('Reindexing %s' % '/'.join(doc.getPhysicalPath()))
            doc.reindexObject(idxs=['checked_out'])

        # Migrate WebDAV locks
        lockable = IRefreshableLockable(doc)
        if lockable.locked():
            locks = doc.wl_lockmapping().values()
            for lock in locks:
                if not lock.getCreator():
                    continue

                if lock._creator[1] == old_userid:
                    lock._creator = (lock._creator[0], new_userid)
    def _migrate_checked_out_doc(self, doc, old_userid, new_userid):
        # Migrate "checked out by" information and reindex
        manager = getMultiAdapter((doc, self.portal.REQUEST),
                                  ICheckinCheckoutManager)
        key = CHECKIN_CHECKOUT_ANNOTATIONS_KEY
        if manager.annotations[key] == old_userid:
            manager.annotations[key] = new_userid
            logger.info('Reindexing %s' % '/'.join(doc.getPhysicalPath()))
            doc.reindexObject(idxs=['checked_out'])

        # Migrate WebDAV locks
        lockable = IRefreshableLockable(doc)
        if lockable.locked():
            locks = doc.wl_lockmapping().values()
            for lock in locks:
                if not lock.getCreator():
                    continue

                if lock._creator[1] == old_userid:
                    lock._creator = (lock._creator[0], new_userid)
def isLocked(context):
    lockable = IRefreshableLockable(context)
    lockable.locked()