Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simple_webapp_using_mongodb.py: TypeError("__init__() got an unexpected keyword argument 'fields'",) #91

Open
bobeina opened this issue Jun 16, 2015 · 1 comment
Assignees
Labels

Comments

@bobeina
Copy link

bobeina commented Jun 16, 2015

I got this error when I accessed /admin page.
Solution first:
In method __iter() of class MongoTable, mongodb_backend.py:
Replace line 53
r = self._coll.find(fields=[self.key_name,])
with

r = self._coll.find( { self.key_name : { '$exists': True } } )

Here is traceback:

Traceback (most recent call last):
File "/usr/lib64/python2.7/site-packages/bottle.py", line 862, in _handle
return route.call(*_args)
File "/usr/lib64/python2.7/site-packages/bottle.py", line 1732, in wrapper
rv = callback(_a, *_ka)
File "/usr/lib64/python2.7/site-packages/bottle.py", line 3615, in wrapper
result = func(_args, **kwargs)
File "blog.py", line 169, in admin
for i in tu:
File "/usr/lib64/python2.7/site-packages/cork/cork.py", line 314, in list_users
for un in sorted(self._store.users):
File "/usr/lib64/python2.7/site-packages/cork/mongodb_backend.py", line 53, in iter
r = self._coll.find(fields=[self._key_name,]) #debug
File "/usr/lib64/python2.7/site-packages/pymongo/collection.py", line 929, in find
return Cursor(self, _args, *_kwargs)
TypeError: init() got an unexpected keyword argument 'fields'

@helgisteinar
Copy link

Think
r = self._coll.find( { self._key_name : { '$exists': True } } )

that is _key_name vs. key_name

@FedericoCeratto FedericoCeratto self-assigned this Aug 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants