google-code-export / app-engine-patch

Automatically exported from code.google.com/p/app-engine-patch
0 stars 0 forks source link

Error from common/models.py #102

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Trying again with v1.0b...I can't get my app to run.  I get the following
error:

File "/.../common/models.py", line 136, in __init__
    cls._meta.fields = [PropertyWrapper(p) for p in cls._properties.values()]
AttributeError: can't set attribute

If I comment out that line, the app works again.  (I haven't tested the
Registration)
*****

In common/models.py, you have:
class BaseModel(db.Model):
  """Combined appengine and Django model.

  All models used in the application should derive from this class.

but in your sample app, you have Person, File, Contract all with db.Model,
and not BaseModel.

Thank you

Original issue reported on code.google.com by ken...@gmail.com on 10 Mar 2009 at 3:16

GoogleCodeExporter commented 9 years ago
Sorry, it defaulted to 'Defect', when in fact it is just my not understanding 
the setup.

Original comment by ken...@gmail.com on 10 Mar 2009 at 3:17

GoogleCodeExporter commented 9 years ago
Just don't use that BaseModel. Derive from db.Model directly and use Google's 
API.

Original comment by wkornew...@gmail.com on 10 Mar 2009 at 6:58

GoogleCodeExporter commented 9 years ago
I am afraid I will have too many hidden bugs if I switch from BaseModel to plain
db.Model.  There was a reason why I chose BaseModel, though I cannot think of it
right now.

In my app's models.py, I have:

from common.models import BaseModel

So, it is importing from AEP's models.  But, I cannot use it?

In your PropertiedClassWithDjango, you have:

<code>
if name == 'BaseModel':
    return

cls._meta.fields = [PropertyWrapper(p) for p in cls._properties.values()]'
</code>

But it does not return when accessing my: class MyModel(BaseModel)

It still tries to assign the cls._meta.fields

Thanks.

Original comment by ken...@gmail.com on 10 Mar 2009 at 3:53

GoogleCodeExporter commented 9 years ago
It's impossible to support BaseModel because it overrides our own db.Model 
patches.
I'm sorry, but your only option is to switch. BaseModel really doesn't offer 
anything
important, anyway. It's far from emulating even a small part of Django, so it's
basically useless and that's why I started app-engine-patch in the first place. 
I
didn't like that django-helper introduces a useless new model base class which 
makes
porting open-source apps more difficult for absolutely no good reason.

Original comment by wkornew...@gmail.com on 10 Mar 2009 at 3:57

GoogleCodeExporter commented 9 years ago
OK, so far, so good.  I have switched back from BaseModel to db.Model, and have 
not
yet found anything that did not work properly.

Thanks.

Original comment by 0360...@gmail.com on 10 Mar 2009 at 5:50