amnong / easywebdav

A WebDAV Client in Python
http://pypi.python.org/pypi/easywebdav/
ISC License
207 stars 113 forks source link

Fix child.text==None #37

Open sashabaranov opened 9 years ago

sashabaranov commented 9 years ago

With dCache I got next issue:

Traceback (most recent call last):
  File "webdav_test.py", line 3, in <module>
    print webdav.ls()
  File "easywebdav/easywebdav/client.py", line 184, in ls
    return [elem2file(elem) for elem in tree.findall('{DAV:}response')]
  File "easywebdav/easywebdav/client.py", line 40, in elem2file
    int(prop(elem, 'getcontentlength', 0)),
TypeError: int() argument must be a string or a number, not 'NoneType'

The idea is that in prop function child.text was returned, but it was None.

Here are some print child, child.text from prop function:

<Element '{DAV:}href' at 0x7fb5d1a00510> /./
<Element '{DAV:}getcontentlength' at 0x7fb5d1a00810> None