Re: 'WSGIRequest' object has no attribute 'update'

2011-07-11 Thread Phang Mulianto
>
>
> The bug is in this line. render_to_response() takes a dictionary as the
> context_instance, but this code just passes the request instance.
>
> You probably meant either:
>
> return render_to_response(template_name, locals(),
> context_instance=(request, ))  # Note comma
>
> or
>
> return render_to_response(template_name, locals(),
> context_instance={'request':request}))
>
> HTH,
>
> Malcolm
>
>
> Hi Malcolm,

already try your reccomendation, but still got error.

and i check with other view in the apps, i found out you are right, the bug
is in the render_to_response.

i fix it with this one :
  return render_to_response(template_name,
locals(),context_instance=RequestContext(request))

i miss the RequestContext(request))

This one think which pass all the context processed variable to the
template.

Thanks, and i learn now how to read error message and track it down now..

It solved now..

continue to learning...

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: 'WSGIRequest' object has no attribute 'update'

2011-07-11 Thread Malcolm Box
Hi,.

On 11 July 2011 08:29, Phang Mulianto  wrote:

>
>
> return render_to_response(template_name, locals(),
> context_instance=(request))
>

The bug is in this line. render_to_response() takes a dictionary as the
context_instance, but this code just passes the request instance.

You probably meant either:

return render_to_response(template_name, locals(),
context_instance=(request, ))  # Note comma

or

return render_to_response(template_name, locals(),
context_instance={'request':request}))

HTH,

Malcolm

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: 'WSGIRequest' object has no attribute 'update'

2011-07-11 Thread Phang Mulianto
Hi Shawn,

Here are the view called :

# Create your views here.
from django.shortcuts import render_to_response
from django.template import RequestContext
from ecomstore.cart import cart

def show_cart(request, template_name="cart/cart.html"):
if request.method == 'POST':
postdata = request.POST.copy()
if postdata['submit'] == 'Remove':
cart.remove_from_cart(request)
if postdata['submit'] == 'Update':
cart.update_cart(request)

cart_item_count = cart.cart_item_count(request)
page_title = "Shopping Cart"
cart_subtotal = cart.cart_subtotal(request)
return render_to_response(template_name, locals(),
context_instance=(request))

Thanks for your help..

On Sun, Jul 10, 2011 at 11:57 PM, Shawn Milochik  wrote:

> May we see the rest of your view? If not, you'll have to figure it out by
> examining exactly what your 'request' variable contains. The error is
> clearly from calling update() on it, and it not being allowed.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to django-users+unsubscribe@**
> googlegroups.com .
> For more options, visit this group at http://groups.google.com/**
> group/django-users?hl=en
> .
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: 'WSGIRequest' object has no attribute 'update'

2011-07-10 Thread Shawn Milochik
May we see the rest of your view? If not, you'll have to figure it out 
by examining exactly what your 'request' variable contains. The error is 
clearly from calling update() on it, and it not being allowed.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



'WSGIRequest' object has no attribute 'update'

2011-07-10 Thread Phang Mulianto
Hi all..i am learning django no, using django 1.3 + python 2.7 . i came from
php world...

i am using a book , and follow the code in there, but got error and cannot
find whats the cause. here are the errors.

anyone can give some clue? Thanks
AttributeError at /cart/

'WSGIRequest' object has no attribute 'update'

 Request Method: GET  Request URL: http://127.0.0.1:8000/cart/  Django
Version: 1.3  Exception Type: AttributeError  Exception Value:

'WSGIRequest' object has no attribute 'update'

 Exception Location: c:\python27\lib\site-packages\django\template\loader.py
in render_to_string, line 186  Python Executable:
c:\python27\python.exe  Python
Version: 2.7.2  Python Path:

['C:\\Users\\mulianto\\workspace\\ecomstore\\src\\ecomstore',
 'c:\\python27\\lib\\site-packages\\setuptools-0.6c11-py2.7.egg',
 'C:\\Windows\\system32\\python27.zip',
 'c:\\python27\\DLLs',
 'c:\\python27\\lib',
 'c:\\python27\\lib\\plat-win',
 'c:\\python27\\lib\\lib-tk',
 'c:\\python27',
 'c:\\python27\\lib\\site-packages']

 Server time: Sun, 10 Jul 2011 13:23:33 +0800
Environment:


Request Method: GET
Request URL: http://127.0.0.1:8000/cart/

Django Version: 1.3
Python Version: 2.7.2
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.admin',
 'django.contrib.flatpages',
 'ecomstore.catalog',
 'ecomstore.utils',
 'ecomstore.cart']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware')


Traceback:
File "c:\python27\lib\site-packages\django\core\handlers\base.py" in
get_response
  111. response = callback(request, *callback_args,
**callback_kwargs)
File
"C:\Users\mulianto\workspace\ecomstore\src\ecomstore\..\ecomstore\cart\views.py"
in show_cart
  17. return render_to_response(template_name, locals(),
context_instance=(request))
File "c:\python27\lib\site-packages\django\shortcuts\__init__.py" in
render_to_response
  20. return HttpResponse(loader.render_to_string(*args, **kwargs),
**httpresponse_kwargs)
File "c:\python27\lib\site-packages\django\template\loader.py" in
render_to_string
  186. context_instance.update(dictionary)

Exception Type: AttributeError at /cart/
Exception Value: 'WSGIRequest' object has no attribute 'update'

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.