straight55b / app-engine-patch

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

'''dict' object has no attribute 'split''' when followıng forms example. #202

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. I am trying to follow the contact (but renamed to 'enquiry') form 
example in http://www.djangobook.com/en/2.0/chapter07/

My templates are in
C:\Documents and Settings\GeoffK\My 
Documents\ing\ingsite\ingilizcewebsitesi\templates
which is a subdirectory of my application directory.

What is the expected output? What do you see instead?

On attemptıng to display the form I get the output below. I am not very 
experienced with Django, GAE etc so not sure if this is a bug or whether I 
have set something up wrong. If it is a bug can I work around it?

What version of the product are you using? On what operating system?
1.1 on Wındows XP

Please provide any additional information below.

AttributeError at /enquiry/
'dict' object has no attribute 'split'
Request Method: GET
Request URL:    http://localhost:8000/enquiry/
Exception Type: AttributeError
Exception Value:    
'dict' object has no attribute 'split'
Exception Location: C:\Documents and Settings\GeoffK\My 
Documents\ing\ingsite\common\appenginepatch\ragendja\template.py in 
app_prefixed_loader, line 45
Python Executable:  C:\Python25\python.exe
Python Version: 2.5.4
Python Path:    ['C:\\Documents and Settings\\GeoffK\\My 
Documents\\ing\\ingsite', 'C:\\Documents and Settings\\GeoffK\\My 
Documents\\ing\\ingsite\\common', 'C:\\Documents and Settings\\GeoffK\\My 
Documents\\ing\\ingsite\\common\\appenginepatch\\appenginepatcher\\lib', 
'C:\\Documents and Settings\\GeoffK\\My 
Documents\\ing\\ingsite\\common\\zip-packages\\django-1.1.zip', 
'C:\\Documents and Settings\\GeoffK\\My 
Documents\\ing\\ingsite\\common\\appenginepatch', 'C:\\Program 
Files\\Google\\google_appengine', 'C:\\Program 
Files\\Google\\google_appengine\\lib\\antlr3', 'C:\\Program 
Files\\Google\\google_appengine\\lib\\django', 'C:\\Program 
Files\\Google\\google_appengine\\lib\\webob', 'C:\\Program 
Files\\Google\\google_appengine\\lib\\yaml\\lib', 'C:\\Documents and 
Settings\\GeoffK\\My Documents\\ing\\ingsite', 'C:\\Documents and 
Settings\\GeoffK\\My Documents\\ing\\ingsite', 
'C:\\WINDOWS\\system32\\python25.zip', 'C:\\Python25\\DLLs', 
'C:\\Python25\\lib', 'C:\\Python25\\lib\\plat-win', 
'C:\\Python25\\lib\\lib-tk', 'C:\\Python25', 'C:\\Python25\\lib\\site-
packages']
Server time:    Fri, 7 Aug 2009 18:53:54 +0100
Traceback Switch to copy-and-paste view

C:\Documents and Settings\GeoffK\My 
Documents\ing\ingsite\ingilizcewebsitesi\views.py in enquiry
    return render('enquiry.html', {'form': form}) ...
▶ Local vars
C:\Documents and Settings\GeoffK\My 
Documents\ing\ingsite\common\appenginepatch\ragendja\template.py in 
render_to_response
    response = HttpResponse(render_to_string(request, template_name, data), 
...
▶ Local vars
C:\Documents and Settings\GeoffK\My 
Documents\ing\ingsite\common\appenginepatch\ragendja\template.py in 
render_to_string
        context_instance=RequestContext(request)) ...
▶ Local vars
C:\Documents and Settings\GeoffK\My 
Documents\ing\ingsite\common\appenginepatch\ragendja\template.py in 
app_prefixed_loader
        return func
# The following defines a template loader that loads templates from a 
specific
# app based on the prefix of the template path:
# get_template("app/template.html") => app/templates/template.html
# This keeps the code DRY and prevents name clashes.
def app_prefixed_loader(template_name, template_dirs=None):
    packed = template_name.split('/', 1) ...
    if len(packed) == 2 and packed[0] in app_template_dirs:
        path = os.path.join(app_template_dirs[packed[0]], packed[1])
        try:
            return (open(path).read().decode(settings.FILE_CHARSET), path)
        except IOError:
            pass

Original issue reported on code.google.com by Geoff.Ke...@gmail.com on 7 Aug 2009 at 6:18

GoogleCodeExporter commented 9 years ago
Ah I had a look at
http://code.google.com/p/app-engine-patch/wiki/RagendjaTemplate
and if I understand it right render_to_response has a different 
number of mandatory parameters than the standard Django
render_to_response?

If that is right perhaps app-engine-patch just needs an error message to say 
that if we 
enter too few parameters?

Original comment by Geoff.Ke...@gmail.com on 9 Aug 2009 at 10:37

GoogleCodeExporter commented 9 years ago
I see native support of GAE by Django is now being looked at. So maybe not 
worth you 
looking at this further. I don't know how to cancel it myself but if you think 
appropriate please close this issue.

Original comment by Geoff.Ke...@gmail.com on 12 Aug 2009 at 2:14

GoogleCodeExporter commented 9 years ago
Problem is the order of parameters you send to render_to_response.

This is correct: render_to_response(request, template, context)

appengine-patch changed this order from the default django's.

Original comment by acafon@gmail.com on 22 Aug 2009 at 9:54