Menu

#90 Locking a file fails with a tuple indices type error

0.50
closed
nobody
2012-11-26
2012-11-24
No

Attempting to place a lock on an object fails with a tuple indices error.

DEBUG:http:Selected <DocumentObject path="/dav/Projects/test123/Documents/Untitled1.png"/> as handler
DEBUG:pathobject.Untitled1.png:Lock info for LOCK operation: (True, <Lock token="opaquelocktoken:019699f4-6809-4408-853c-42dfc06352fa" objectId=94410 contextId=23330 granted=1353797630 expires=1353801230 exclusive="Y">)
DEBUG:context:Context commit requested.
DEBUG:context:Context commit completed.
ERROR:http:tuple indices must be integers, not str
Traceback (most recent call last):
  File "/home/awilliam/projects/coils/coils/net/handler.py", line 163, in process_request
    getattr(handler, 'do_{0}'.format(self.command))()
  File "/home/awilliam/projects/coils/coils/net/foundation/dav.py", line 696, in do_LOCK
    if ('TEXT' in lockinfo['owner']):
TypeError: tuple indices must be integers, not str

Related

Wiki: MSRedirector

Discussion

  • Adam Tauno Williams

    Lock attempt payload

    <?xml version="1.0" encoding="utf-8" ?>
    <D:lockinfo xmlns:D="DAV:">
        <D:lockscope><D:exclusive/></D:lockscope>
        <D:locktype><D:write/></D:locktype>
        <D:owner><D:href>awilliam</D:href></D:owner>
    </D:lockinfo>
    

    Lock parser successfully grinds that into -

    {'exclusive': 'Y',
     'expires': 0,
     'granted': 0,
     'kind': 'W',
     'objectId': 94480,
     'owner': {'XML': '<D:owner xmlns:D="DAV:"><D:href>awilliam</D:href></D:owner>'},
     'ownerId': 23330,
     'token': 'dab89b1c-2b3a-405b-90b3-52f5971d7557'}
    

    Lock operation succeeds generating a Lock object.

    True <Lock token="opaquelocktoken:aaf568b4-2f8d-4a30-bd95-4a39e84192e8" objectId=94480 contextId=23330 granted=1353798988 expires=1353802588 exclusive="Y">
    

    We are just failing in generating the lock response.

     
  • Adam Tauno Williams

    Fixed in r4360 (b02f4292790d)

     
  • Adam Tauno Williams

    • status: open --> closed
     
  • Adam Tauno Williams

    • labels: lock, webdav --> lock, webdav, MSRedirector
     

Log in to post a comment.

MongoDB Logo MongoDB