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

pymongo 3.0 #153

Closed
Garito opened this issue Jun 4, 2015 · 9 comments
Closed

pymongo 3.0 #153

Garito opened this issue Jun 4, 2015 · 9 comments

Comments

@Garito
Copy link

Garito commented Jun 4, 2015

Hi!
I would like to update pymongo to 3.0
Did you know when will be flask-mongoengine ready to do so?
As soon as I update it I raises and error
I've tryed to install masters versions of mongoengine (proposed by the people in charge) and yours but the errors is still there
Let me put the traceback here to:

127.0.0.1 - - [04/Jun/2015 17:54:34] "GET / HTTP/1.1" 500 -
Traceback (most recent call last):
  File "/Users/garito/TimeFounder/App/0.3/env/lib/python2.7/site-packages/flask/app.py", line 1836, in __call__
    return self.wsgi_app(environ, start_response)
  File "/Users/garito/TimeFounder/App/0.3/env/lib/python2.7/site-packages/flask/app.py", line 1820, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/Users/garito/TimeFounder/App/0.3/env/lib/python2.7/site-packages/flask/app.py", line 1403, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/Users/garito/TimeFounder/App/0.3/env/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/Users/garito/TimeFounder/App/0.3/env/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/Users/garito/TimeFounder/App/0.3/env/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/Users/garito/TimeFounder/App/0.3/env/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Users/garito/TimeFounder/App/0.3/env/lib/python2.7/site-packages/flask_debugtoolbar/__init__.py", line 125, in dispatch_request
    return view_func(**req.view_args)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/cProfile.py", line 149, in runcall
    return func(*args, **kw)
  File "/Users/garito/TimeFounder/App/0.3/TimeFounder/__init__.py", line 207, in root
    return tree('', 'view')
  File "/Users/garito/TimeFounder/App/0.3/TimeFounder/__init__.py", line 274, in tree
    return abort(404) if method is None else method(obj)
  File "/Users/garito/TimeFounder/App/0.3/TimeFounder/models/section.py", line 84, in view
    if current_user in self.leaders and current_user == self.leaders[0]:
  File "/Users/garito/TimeFounder/App/0.3/env/lib/python2.7/site-packages/mongoengine/base/fields.py", line 245, in __get__
    name=self.name
  File "/Users/garito/TimeFounder/App/0.3/env/lib/python2.7/site-packages/mongoengine/dereference.py", line 78, in __call__
    self.object_map = self._fetch_objects(doc_type=doc_type)
  File "/Users/garito/TimeFounder/App/0.3/env/lib/python2.7/site-packages/mongoengine/dereference.py", line 143, in _fetch_objects
    for ref in references:
  File "/Users/garito/TimeFounder/App/0.3/env/lib/python2.7/site-packages/pymongo/cursor.py", line 983, in next
    if len(self.__data) or self._refresh():
  File "/Users/garito/TimeFounder/App/0.3/env/lib/python2.7/site-packages/flask_mongoengine/operation_tracker.py", line 168, in _cursor_refresh
    snapshot = privar("snapshot")
  File "/Users/garito/TimeFounder/App/0.3/env/lib/python2.7/site-packages/flask_mongoengine/operation_tracker.py", line 136, in privar
    return getattr(cursor_self, '_Cursor__{0}'.format(name))
AttributeError: 'Cursor' object has no attribute '_Cursor__snapshot'

Any ideas?

Thanks!

@Garito
Copy link
Author

Garito commented Jun 13, 2015

Anyone here?

@rozza
Copy link
Contributor

rozza commented Jun 15, 2015

I'm not sure that mongoengine support for pymongo 3.0 has been released yet.

@Garito
Copy link
Author

Garito commented Jun 15, 2015

They are waiting for us in that matter... I'm asking here as a suggestion from them

@Garito
Copy link
Author

Garito commented Jun 15, 2015

@Garito
Copy link
Author

Garito commented Jun 24, 2015

Since mongoengine has updated its dependencies to pymongo 3.0 this extension doesn't work anymore

@rozza
Copy link
Contributor

rozza commented Jun 26, 2015

Currently, you'd have to lock mongoengine versions until someone from the community investigates and fixes the issue.

This project open source and as such is looking for active users from the community to step up and become maintainers.

@Garito
Copy link
Author

Garito commented Jun 26, 2015

I know and understand open source but here we need to be honest and if this volutaries don't show up more soon than later will be better that someone put a huge warning telling this extension is out of date

We, as open source users, need to be patience but open source creators need to be honest since the users are making a de facto contract of trust when they choose to use the piece of software

@mgellesch
Copy link

If you change the line in flask_mongoengine/operation_tracker.py from
snapshot = privar("snapshot")
to snapshot = '' it works. Dirty hack, but ok. The privar approach certainly does seem a little unconventional

@rochacbruno
Copy link
Contributor

The solution is to change the line 140 of operation_tracker.py

from

    def privar(name):
        return getattr(cursor_self, '_Cursor__{0}'.format(name))

to

    def privar(name):
        return getattr(cursor_self, '_Cursor__{0}'.format(name), None)

I am sending the PR

rochacbruno added a commit to quokkaproject/flask-mongoengine that referenced this issue Aug 24, 2015
losintikfos added a commit that referenced this issue Aug 24, 2015
Fix #153 privar() return None when attr is not found
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants