Skip to content

Commit

Permalink
- lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dataflake committed Jan 31, 2020
1 parent 726ba1b commit a4db2eb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/App/ApplicationManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
from AccessControl.requestmethod import requestmethod
from Acquisition import Implicit
from App.config import getConfiguration
from App.Management import Tabs
from App.DavLockManager import DavLockManager
from App.Management import Tabs
from App.special_dtml import DTMLFile
from App.Undo import UndoSupport
from App.version_txt import version_txt
Expand Down
19 changes: 12 additions & 7 deletions src/App/DavLockManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,31 @@

from AccessControl.class_init import InitializeClass
from AccessControl.SecurityInfo import ClassSecurityInfo
from Acquisition import aq_base
from Acquisition import Implicit
from Acquisition import aq_base
from App.special_dtml import DTMLFile
from OFS.Lockable import wl_isLocked
from OFS.SimpleItem import Item


manage_webdav_locks = 'Manage WebDAV Locks'


class DavLockManager(Item, Implicit):
id = 'DavLockManager'
name = title = 'WebDAV Lock Manager'
meta_type = 'WebDAV Lock Manager'

security = ClassSecurityInfo()
security.declareProtected('Manage WebDAV Locks',
'findLockedObjects', 'manage_davlocks',
'manage_unlockObjects')
security.declarePrivate('unlockObjects')

security.declareProtected(manage_webdav_locks, # NOQA: D001
'manage_davlocks')
manage_davlocks = manage_main = manage = DTMLFile(
'dtml/davLockManager', globals())
manage_davlocks._setName('manage_davlocks')
manage_options = ({'label': 'Write Locks', 'action': 'manage_main'}, )

@security.protected(manage_webdav_locks)
def findLockedObjects(self, frompath=''):
app = self.getPhysicalRoot()

Expand All @@ -45,7 +47,7 @@ def findLockedObjects(self, frompath=''):
# since the above will turn '/' into an empty string, check
# for truth before chopping a final slash
if frompath and frompath[-1] == '/':
frompath= frompath[:-1]
frompath = frompath[:-1]

# Now we traverse to the node specified in the 'frompath' if
# the user chose to filter the search, and run a ZopeFind with
Expand All @@ -55,13 +57,15 @@ def findLockedObjects(self, frompath=''):

return lockedobjs

@security.private
def unlockObjects(self, paths=[]):
app = self.getPhysicalRoot()

for path in paths:
ob = app.unrestrictedTraverse(path)
ob.wl_clearLocks()

@security.protected(manage_webdav_locks)
def manage_unlockObjects(self, paths=[], REQUEST=None):
" Management screen action to unlock objects. "
if paths:
Expand Down Expand Up @@ -91,7 +95,7 @@ def _findapply(self, obj, result=None, path=''):
else:
p = id

dflag = hasattr(ob, '_p_changed') and (ob._p_changed == None)
dflag = hasattr(ob, '_p_changed') and (ob._p_changed is None)
bs = aq_base(ob)
if wl_isLocked(ob):
li = []
Expand All @@ -108,4 +112,5 @@ def _findapply(self, obj, result=None, path=''):

return result


InitializeClass(DavLockManager)

0 comments on commit a4db2eb

Please sign in to comment.