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

quitar enum field #23

Open
felipao-mx opened this issue Dec 9, 2020 · 3 comments
Open

quitar enum field #23

felipao-mx opened this issue Dec 9, 2020 · 3 comments

Comments

@felipao-mx
Copy link
Member

felipao-mx commented Dec 9, 2020

el paquete extras-mongoengine ya implementa enumfield. Deberíamos usar ese
https://github.com/MongoEngine/extras-mongoengine/blob/master/extras_mongoengine/fields.py

https://pypi.org/project/extras_mongoengine/

UPDATE: como menciona @agarrido19 abajo mejor usar el nativo de mongoengine por lo que no es necesario tener codigo en agave de EnumField

@felipao-mx felipao-mx mentioned this issue Dec 9, 2020
@agarrido19
Copy link
Contributor

De hecho mongoengine directamente ya tiene EnumField https://docs.mongoengine.org/changelog.html#changes-in-0-21-0

  • Add EnumField: mongoengine.fields.EnumField

@agarrido19
Copy link
Contributor

agarrido19 commented Dec 9, 2020

Pero todavía tiene problemas internos, no recomiendo usar mongoengine==0.21.0

  File "/Users/agarrido/PycharmProjects/agave/agave/blueprints/rest_api.py", line 178, in query
    return _count(filters)
  File "/Users/agarrido/PycharmProjects/agave/agave/blueprints/rest_api.py", line 182, in _count
    count = cls.model.objects.filter(filters).count()
  File "/Users/agarrido/PycharmProjects/agave/venv/lib/python3.8/site-packages/mongoengine/queryset/queryset.py", line 144, in count
    return super().count(with_limit_and_skip)
  File "/Users/agarrido/PycharmProjects/agave/venv/lib/python3.8/site-packages/mongoengine/queryset/base.py", line 430, in count
    filter=self._cursor._Cursor__spec,
AttributeError: 'Cursor' object has no attribute '_Cursor__spec'

@agarrido19
Copy link
Contributor

agarrido19 commented Dec 10, 2020

En un issue de mongoengine se explica el porqué del error de arriba: MongoEngine/mongoengine#2425

Basicamente, pymongo no expone publicamente el API para el manejo del cursor, y mongomock no puede resolverlo directamente, el mantenedor de mongomock menciona que es un feature que no creen implementar.

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

2 participants