Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
glpatcern committed Nov 24, 2022
1 parent 5b15c78 commit 0cca5bc
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/core/wopi.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,8 @@ def setLock(fileid, reqheaders, acctok):
retrievedLock, lockHolder = utils.retrieveWopiLock(fileid, op, lock, acctok)
# validate against either the given lock (RefreshLock case) or the given old lock (UnlockAndRelock case)
if retrievedLock and not utils.compareWopiLocks(retrievedLock, (oldLock if oldLock else lock)):
# lock mismatch, the WOPI client is supposed to acknowledge the existing lock
# and deny access to the file in edit mode otherwise
# lock mismatch, the WOPI client is supposed to acknowledge the existing lock to start a collab session,
# or deny access to the file in edit mode otherwise
return utils.makeConflictResponse(op, acctok['userid'], retrievedLock, lock, oldLock, acctok['endpoint'], fn,
'The file is locked by %s' %
(lockHolder if lockHolder != 'wopi' else 'another online editor')) # TODO cleanup 'wopi' case
Expand Down
2 changes: 1 addition & 1 deletion src/core/wopiutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def validateAndLogHeaders(op):

# update bookkeeping of pending sessions
if op.title() == 'Checkfileinfo' and session in srv.conflictsessions['pending'] and \
time.mktime(time.strptime(srv.conflictsessions['pending'][session]['time'])) < time.time() - 300:
time.mktime(time.strptime(srv.conflictsessions['pending'][session]['time'])) < time.time() - 300:
# a previously conflicted session is still around executing Checkfileinfo after 5 minutes, assume it got resolved
_resolveSession(session, acctok['filename'])
return acctok, None
Expand Down
9 changes: 5 additions & 4 deletions src/core/xrootiface.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,11 @@ def statx(endpoint, fileref, userid, versioninv=1):
+ '&mgm.pcmd=fileinfo&mgm.file.info.option=-m')
try:
# output looks like:
# keylength.file=35 file=/eos/.../filename size=2915 mtime=1599649863.0 ctime=1599649866.280468540 btime=1599649866.280468540 clock=0 mode=0644
# uid=4179 gid=2763 fxid=19ab8b68 fid=430672744 ino=115607834422411264 pid=1713958 pxid=001a2726 xstype=adler xs=a2dfcdf9
# etag="115607834422411264:a2dfcdf9" detached=0 layout=replica nstripes=2 lid=00100112 nrep=2 xattrn=sys.eos.btime xattrv=1599649866.280468540
# uid:xxxx[username] gid:xxxx[group] tident:xxx name:username dn: prot:https host:xxxx.cern.ch domain:cern.ch geo: sudo:0 fsid=305 fsid=486
# keylength.file=35 file=/eos/.../filename size=2915 mtime=1599649863.0 ctime=1599649866.280468540
# btime=1599649866.280468540 clock=0 mode=0644 uid=xxxx gid=xxxx fxid=19ab8b68 fid=430672744 ino=115607834422411264
# pid=1713958 pxid=001a2726 xstype=adler xs=a2dfcdf9 etag="115607834422411264:a2dfcdf9" detached=0 layout=replica
# nstripes=2 lid=00100112 nrep=2 xattrn=sys.eos.btime xattrv=1599649866.280468540 uid:xxxx[username] gid:xxxx[group]
# tident:xxx name:username dn: prot:https host:xxxx.cern.ch domain:cern.ch geo: sudo:0 fsid=305 fsid=486
# cf. https://gitlab.cern.ch/dss/eos/-/blob/master/archive/eosarch/utils.py
kvlist = [kv.split('=') for kv in statInfo.split()]
statxdata = {k: v.strip('"') for k, v in [kv for kv in kvlist if len(kv) == 2]}
Expand Down
5 changes: 2 additions & 3 deletions src/wopiserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ class Wopi:
# sets of sessions for which a lock conflict is outstanding or resolved
conflictsessions = {'pending': {}, 'resolved': {}}


@classmethod
def init(cls):
'''Initialises the application, bails out in case of failures. Note this is not a __init__ method'''
Expand Down Expand Up @@ -344,8 +343,8 @@ def iopOpenInApp():
if bridge.issupported(appname):
try:
res['app-url'], res['form-parameters'] = bridge.appopen(utils.generateWopiSrc(inode), acctok,
(appname, appurl, url_unquote_plus(req.args.get('appinturl', appurl)), req.headers.get('ApiKey')),
viewmode, usertoken)
(appname, appurl, url_unquote_plus(req.args.get('appinturl', appurl)), req.headers.get('ApiKey')), # noqa: E128
viewmode, usertoken)
except bridge.FailedOpen as foe:
return foe.msg, foe.statuscode
else:
Expand Down

0 comments on commit 0cca5bc

Please sign in to comment.