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

KeyError _etag #22

Open
paulocheque opened this issue Sep 15, 2015 · 3 comments
Open

KeyError _etag #22

paulocheque opened this issue Sep 15, 2015 · 3 comments

Comments

@paulocheque
Copy link

I am getting this exception with a simple code. It breaks the /person endpoint and all of other endpoints I receive a 404 error.

screen shot 2015-09-14 at 5 22 28 pm

Using:

  • eve 0.5.3 or in-dev

  • eve-Mongoengine 0.0.9

    class Person(mongoengine.Document):
    name = mongoengine.StringField()
    age = mongoengine.IntField()

    app = Eve()
    ext = EveMongoengine(app)
    ext.add_model(Person)

@bbbbbailey
Copy link

bbbbbailey commented Jul 10, 2016

I had this issue until I changed some settings with the projection, at which point _etag existed. Collections without projection changes had this error, and those with projection changes didn't. Not sure what the underlying issue is but this fixes it.

from models import Person, Address
from eve_mongoengine import EveMongoengine
ext = EveMongoengine(app)
# Register model
ext.add_model([Person, Address])
# Remove password hash and salt from projections, this collection was error free
app.config['SOURCES']['person']['projection'] = {'salt': 0, 'password': 0}
# This next line removed the error, but you need to set all the fields
app.config['SOURCES']['address']['projection'] = {'street': 1, 'zipcode': 1, 'city': 1, 'state': 1}
  • Eve 0.6.4
  • MongoEngine 0.10.6
  • Eve-Mongoengine 0.0.9

@FredLoney
Copy link

See also Eve issue #569.

Qualifying the offending code to read:

projection = [rev_map[field] for field in projection if field in rev_map]

gets past the problem, since the _etag is auto-generated if missing.

@lig
Copy link

lig commented Oct 17, 2017

@seglberg any update on this?

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