[Zope-Checkins] SVN: Zope/branches/2.13/src/App/DavLockManager.py PEP8 / cleanup
Hanno Schlichting
hannosch at hannosch.eu
Tue Dec 7 13:03:44 EST 2010
Log message for revision 118752:
PEP8 / cleanup
Changed:
U Zope/branches/2.13/src/App/DavLockManager.py
-=-
Modified: Zope/branches/2.13/src/App/DavLockManager.py
===================================================================
--- Zope/branches/2.13/src/App/DavLockManager.py 2010-12-07 18:00:52 UTC (rev 118751)
+++ Zope/branches/2.13/src/App/DavLockManager.py 2010-12-07 18:03:43 UTC (rev 118752)
@@ -13,13 +13,13 @@
from AccessControl.class_init import InitializeClass
from AccessControl.SecurityInfo import ClassSecurityInfo
-from AccessControl.SecurityManagement import getSecurityManager
from Acquisition import aq_base
from Acquisition import Implicit
from App.special_dtml import DTMLFile
from OFS.SimpleItem import Item
from webdav.Lockable import wl_isLocked
+
class DavLockManager(Item, Implicit):
id = 'DavLockManager'
name = title = 'WebDAV Lock Manager'
@@ -35,19 +35,18 @@
manage_davlocks = manage_main = manage = DTMLFile(
'dtml/davLockManager', globals())
manage_davlocks._setName('manage_davlocks')
+ manage_options = ({'label': 'Write Locks', 'action': 'manage_main'}, )
- manage_options = (
- {'label': 'Write Locks', 'action': 'manage_main'},
- )
-
def findLockedObjects(self, frompath=''):
app = self.getPhysicalRoot()
if frompath:
- if frompath[0] == '/': frompath = frompath[1:]
+ if frompath[0] == '/':
+ frompath = frompath[1:]
# 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]
+ if frompath and 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
@@ -66,7 +65,8 @@
def manage_unlockObjects(self, paths=[], REQUEST=None):
" Management screen action to unlock objects. "
- if paths: self.unlockObjects(paths)
+ if paths:
+ self.unlockObjects(paths)
if REQUEST is not None:
m = '%s objects unlocked.' % len(paths)
return self.manage_davlocks(self, REQUEST, manage_tabs_message=m)
@@ -80,13 +80,17 @@
base = aq_base(obj)
if not hasattr(base, 'objectItems'):
return result
- try: items = obj.objectItems()
- except: return result
+ try:
+ items = obj.objectItems()
+ except Exception:
+ return result
addresult = result.append
for id, ob in items:
- if path: p = '%s/%s' % (path, id)
- else: p = id
+ if path:
+ p = '%s/%s' % (path, id)
+ else:
+ p = id
dflag = hasattr(ob, '_p_changed') and (ob._p_changed == None)
bs = aq_base(ob)
@@ -94,13 +98,14 @@
li = []
addlockinfo = li.append
for token, lock in ob.wl_lockItems():
- addlockinfo({'owner':lock.getCreatorPath(),
- 'token':token})
+ addlockinfo({'owner': lock.getCreatorPath(),
+ 'token': token})
addresult((p, li))
dflag = 0
if hasattr(bs, 'objectItems'):
self._findapply(ob, result, p)
- if dflag: ob._p_deactivate()
+ if dflag:
+ ob._p_deactivate()
return result
More information about the Zope-Checkins
mailing list