suds-community / suds

Suds is a lightweight SOAP python client for consuming Web Services. A community fork of the jurko fork.
https://suds.readthedocs.io/
GNU Lesser General Public License v3.0
173 stars 56 forks source link

AttributeError: 'ObjectCache' object has no attribute 'setduration' #86

Closed martenlehmann closed 2 years ago

martenlehmann commented 2 years ago

I just tried to migrate from suds-jurko to suds-community. My usage of the cache was exactly as shown at https://github.com/suds-community/suds#performance:

cache = client.options.cache
cache.setduration(days=10)

And yet I got

AttributeError: 'ObjectCache' object has no attribute 'setduration'

I couldn't find a setduration() function in suds/cache.py while there was one in suds-jurko. I was able to make it work in suds-community by using

import datetime
[...]
cache = client.options.cache
cache.duration = datetime.timedelta(days=10)

So I guess only the documentation needs to be updated.

phillbaker commented 2 years ago

Thanks for reporting this.

It looks like this was done in the jurko fork here: https://github.com/suds-community/suds/commit/8969e60889cea345e04ff60daf5489e8b4928d52. However, it was done after the last official release (0.6.0), and so released as part of the first release of this fork.

FileCache takes keyword args that are passed to timedelta, so it could be set on initialize a cache: https://github.com/suds-community/suds/blob/56a3f287e576940696baacc86c4f1405255039a3/suds/cache.py#L122-L124

Your update to the docs looks good, thanks.