CounterpartyXCP / counterwallet

Counterparty web wallet
https://counterwallet.io
147 stars 162 forks source link

__init__() got an unexpected keyword argument 'spec' #774

Closed unsystemizer closed 8 years ago

unsystemizer commented 8 years ago

Reported here, happens only in the betting section: https://counterpartytalk.org/t/i-receive-errors-in-the-betting-section-of-counterwallet/1872

sirdarckcat commented 8 years ago

Seems to be related to https://github.com/CounterpartyXCP/counterblock/commit/aa1f6df5cca0bce510c1f2ba453344947697c408

Here: https://github.com/CounterpartyXCP/counterblock/blob/aa1f6df5cca0bce510c1f2ba453344947697c408/counterblock/lib/modules/betting.py#L117 feeds = config.mongo_db.feeds.find(spec=conditions, projection={'_id': False}, limit=1)

Which tries to call find in the feeds DB, and complains because spec is being called.

Looking at the API: http://api.mongodb.org/python/current/api/pymongo/collection.html#pymongo.collection.Collection.find

There is no spec= parameter anymore.

It used to exist before: https://api.mongodb.org/python/2.9.2/api/pymongo/collection.html#pymongo.collection.Collection.find spec (optional): a SON object specifying elements which must be present for a document to be included in the result set

But it was renamed in 3.0 to filter https://api.mongodb.org/python/3.0/api/pymongo/collection.html#pymongo.collection.Collection.find filter (optional): a SON object specifying elements which must be present for a document to be included in the result set

This would be easy to fix by just removing spec= from the call, since it's the first parameter, then it would work in both 2.9.2 and 3.0.

@robby-dermody

robby-d commented 8 years ago

fixed here: https://github.com/CounterpartyXCP/counterblock/commit/891d47655cd79a3f3886e34a93405686798ba155

thanks for the clear comment on what is wrong