machinalis / iepy

Information Extraction in Python
BSD 3-Clause "New" or "Revised" License
905 stars 186 forks source link

cannot inherit from IEDocument #34

Open francolq opened 10 years ago

francolq commented 10 years ago

In my own app I am trying to subclass IEDocument to have additional fields and methods, but mongoengine says I can't do it. Not sure if bug or design decision, but it would be useful in my case to be able to subclass IEDocument.

For instance:

from iepy.models import IEDocument class MyDocument(IEDocument): ... pass ... Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python2.7/dist-packages/mongoengine/base/metaclasses.py", line 332, in new new_class = super_new(cls, name, bases, attrs) File "/usr/local/lib/python2.7/dist-packages/mongoengine/base/metaclasses.py", line 120, in new base.name) ValueError: Document IEDocument may not be subclassed

jmansilla commented 9 years ago

Mongo is not the ORM used anymore, but Django instead.

Anyway, it will be still not very easy to do it. It's more a design consequence than a strong design decision.

francolq commented 9 years ago

I see. At least, Django will allow subclassing. I am still interested in doing this, so I may be soon commenting on this.