Closed GoogleCodeExporter closed 9 years ago
Could you please try with the latest repo version? I'm too busy to code up the
tests,
right now...
Original comment by wkornew...@gmail.com
on 22 Apr 2009 at 9:26
So, does it work?
Original comment by wkornew...@gmail.com
on 24 Apr 2009 at 9:47
Hi, Great to hear you have made a fix. Unfortunately I've got a bit stuck
trying to
test. I originally started developing my app based on the sample app you have
provided.
So today, I downloaded the latest sample app - I notice it uses django-1.1 now.
When I try to start that, I get the following error:
(I'm running on mac osx 10.5.6)
$ python manage.py runserver 8001
WARNING:root:Could not read datastore data from
/var/folders/hE/hEG11sliHkq0hizsuH4Zg++++TI/-Tmp-/django_aep-sample.datastore
WARNING:root:Could not read datastore data from
/var/folders/hE/hEG11sliHkq0hizsuH4Zg++++TI/-Tmp-/django_aep-sample.datastore.hi
story
Traceback (most recent call last):
File "manage.py", line 4, in <module>
setup_env(manage_py_env=True)
File "/Users/tom/svn/aep/appenginepatch-sample/common/appenginepatch/aecmd.py",
line 63, in setup_env
patch_all()
File
"/Users/tom/svn/aep/appenginepatch-sample/common/appenginepatch/appenginepatcher
/patch.py",
line 21, in patch_all
patch_django()
File
"/Users/tom/svn/aep/appenginepatch-sample/common/appenginepatch/appenginepatcher
/patch.py",
line 588, in patch_django
from ragendja import template
File
"/Users/tom/svn/aep/appenginepatch-sample/common/appenginepatch/ragendja/templat
e.py", line
74, in <module>
add_to_builtins(lib)
File "/Users/tom/svn/aep/appenginepatch-sample/__init__.py", line 959, in
add_to_builtins
File "/Users/tom/svn/aep/appenginepatch-sample/__init__.py", line 948, in get_library
File
"/Users/tom/svn/aep/appenginepatch-sample/common/zip-packages/django-1.1.zip/dja
ngo/utils/importlib.py",
line 35, in import_module
File
"/Users/tom/svn/aep/appenginepatch-sample/common/appenginepatch/ragendja/templat
etags/ragendjatags.py",
line 8, in <module>
from ragendja.dbutils import prefetch_references
File
"/Users/tom/svn/aep/appenginepatch-sample/common/appenginepatch/ragendja/dbutils
.py",
line 4, in <module>
from django.utils import simplejson
File "/Users/tom/svn/aep/appenginepatch-sample/__init__.py", line 111, in <module>
File "/Users/tom/svn/aep/appenginepatch-sample/__init__.py", line 108, in <module>
File
"/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-de
fault.bundle/Contents/Resources/google_appengine/google/appengine/dist/py_zipimp
ort.py",
line 213, in load_module
exec code in mod.__dict__
File
"/Library/Python/2.5/site-packages/simplejson-2.0.9-py2.5-macosx-10.5-i386.egg/s
implejson/decoder.py",
line 7, in <module>
File
"/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-de
fault.bundle/Contents/Resources/google_appengine/google/appengine/dist/py_zipimp
ort.py",
line 213, in load_module
exec code in mod.__dict__
File
"/Library/Python/2.5/site-packages/simplejson-2.0.9-py2.5-macosx-10.5-i386.egg/s
implejson/scanner.py",
line 5, in <module>
File
"/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-de
fault.bundle/Contents/Resources/google_appengine/google/appengine/dist/py_zipimp
ort.py",
line 213, in load_module
exec code in mod.__dict__
File
"/Library/Python/2.5/site-packages/simplejson-2.0.9-py2.5-macosx-10.5-i386.egg/s
implejson/_speedups.py",
line 7, in <module>
File
"/Library/Python/2.5/site-packages/simplejson-2.0.9-py2.5-macosx-10.5-i386.egg/s
implejson/_speedups.py",
line 4, in __bootstrap__
File
"/Library/Python/2.5/site-packages/setuptools-0.6c9-py2.5.egg/pkg_resources.py",
line
841, in resource_filename
self, resource_name
File
"/Library/Python/2.5/site-packages/setuptools-0.6c9-py2.5.egg/pkg_resources.py",
line
1311, in get_resource_filename
return self._extract_resource(manager, zip_path)
File
"/Library/Python/2.5/site-packages/setuptools-0.6c9-py2.5.egg/pkg_resources.py",
line
1342, in _extract_resource
os.write(outf, self.loader.get_data(zip_path))
File
"/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-de
fault.bundle/Contents/Resources/google_appengine/google/appengine/dist/py_zipimp
ort.py",
line 226, in get_data
(fullpath, required_prefix))
IOError: Path 'simplejson/_speedups.so' doesn't start with zipfile name
'/Library/Python/2.5/site-packages/simplejson-2.0.9-py2.5-macosx-10.5-i386.egg/'
I was going to copy my app into here to test.
Or.. should I be using downloading just the 'django-app-engine-dev' repo,
zipping it
and replacing my existing django-1.02.zip in zip-files?
Thanks
Original comment by tommytastic
on 24 Apr 2009 at 1:43
I guess you'll have to remove your simplejson package because that isn't
compatible
with App Engine. As an alternative, you could add a simplejson.py file to your
"common" folder which contains simply this line:
raise ImportError("Only Django's internal simplejson package is supported!")
Original comment by wkornew...@gmail.com
on 24 Apr 2009 at 5:47
Hmm I see - I wonder why I wasn't getting the error previously.
Managed to get it going again, removed my hacks to 'exclude' class fields and it
works! So your fix seems to be doing the trick . Will keep an eye on it and
report
back. Entering another issue regarding FromWithSets and 'initial' values.
Original comment by tommytastic
on 24 Apr 2009 at 9:54
Great! :)
Original comment by wkornew...@gmail.com
on 24 Apr 2009 at 10:18
I have the same problem with appengine 1.2.5.
My Models and ModelForms are in external module named modules.py
Although I add the line "exclude = [ 'class' ]" in my ModelForm it not works.
Original comment by big...@gmail.com
on 30 Sep 2009 at 1:28
I had to back out of using polymodel in my django on app engine application as
well.
I would get the same django form error on the base or subclass model. I
couldn't
find an answer on line on how to get django to ignore 'class' in the models
returned
from the datastore.
Original comment by SCBoe...@gmail.com
on 25 Jan 2010 at 8:00
This issue is not fixed (this is with r102 from SVN):
==== models.py
from google.appengine.ext import db
from google.appengine.ext.db import polymodel
class Person(polymodel.PolyModel):
first_name = db.StringProperty()
last_name = db.StringProperty()
dob = db.DateProperty(verbose_name="Date of Birth")
class Adult(Person):
interests = db.StringListProperty()
==== views.py
import logging
from google.appengine.ext import db
from django import forms
from google.appengine.ext.db import djangoforms
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from testing import models
class AdultForm(djangoforms.ModelForm):
class Meta:
model = models.Adult
exclude = ( 'class', 'create_ts', 'modify_ts', 'edited_by', )
def adult_form(request, person_id=None):
if request.method == 'POST':
if person_id:
# update an existing person with data from the form
adult = models.Adult.get_by_id(int(person_id))
form = AdultForm(request.POST, instance=adult)
else:
# create a new person solely from the form data
form = AdultForm(request.POST)
if form.is_valid():
# django doesn't know how to commit to gae
adult = form.save(commit=False)
adult.put()
return HttpResponseRedirect('/')
else:
if person_id:
# new form filled out with existing data
adult = models.Adult.get_by_id(int(person_id))
form = AdultForm(instance=adult)
else:
# new, empty form
form = AdultForm()
return render_to_response('adult_form.html', {
'person_id': person_id,
'form': form,
})
====
Environment:
Request Method: GET
Request URL: http://localhost:8080/testing/10
Django Version: 1.1.1
Python Version: 2.5.5
Installed Applications:
('appengine_django',)
Installed Middleware:
('django.middleware.common.CommonMiddleware',)
Traceback:
File "/opt/local/lib/python2.5/site-packages/django/core/handlers/
base.py" in get_response
92. response = callback(request, *callback_args,
**callback_kwargs)
File "/Users/b/src/bepreparedapp/testing/views.py" in adult_form
38. form = AdultForm(instance=adult)
File "/Users/b/Applications/Developer/GoogleAppEngineLauncher.app/
Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/
google_appengine/google/appengine/ext/db/djangoforms.py" in __init__
753. object_data[name] = prop.get_value_for_form(instance)
File "/Users/b/Applications/Developer/GoogleAppEngineLauncher.app/
Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/
google_appengine/google/appengine/ext/db/djangoforms.py" in
get_value_for_form
191. return getattr(instance, self.name)
Exception Type: AttributeError at /testing/10
Exception Value: 'Adult' object has no attribute 'class'
Original comment by benjamin...@gmail.com
on 14 Apr 2010 at 8:50
A workaround, found on the main google-appengine list ('djangoforms.ModelForm
for PolyModel ??', Oct 09),
is to exclude the '_class' attribute (not 'class').
e.g. for my previous example:
class AdultForm(djangoforms.ModelForm):
class Meta:
model = models.Adult
exclude = ( '_class', 'create_ts', 'modify_ts', 'edited_by', )
Original comment by benjamin...@gmail.com
on 14 Apr 2010 at 9:14
Original issue reported on code.google.com by
tommytastic
on 21 Apr 2009 at 11:29