> One thing to keep in mind is that the object is shared across all requests
> in that process, so you can't actually store state on your object.

What exactly do you mean? Because I just got very worried.

I have a class like this:

class CreateAddressService(RequestService):
        
        def prepare(self, request, *args, **kwargs):
                self.subject = Subject.get_or_404(request.session['user_id'],
                                                                                
  int(kwargs['subject']))
                
        def servePost(self, request, *args, **kwargs):
                self.form = AddressForm(request.POST)
                if self.form.is_valid():
                        self.form.save(self.subject, request.session['user_id'])
                        return HttpResponseRedirect('/edit_address/' + \
                                                                                
unicode(self.subject.id))
                                                                                
        def serveGet(self, request, *args, **kwargs):
                self.form = AddressForm()
                
        def serveBoth(self, request, *args, **kwargs):
                dictionary = {'form': self.form}
                return render_to_response('create_address.html', dictionary)

Does it mean, that this object can be shared across multiple requests
from multiple users?

Can I then use constructors and create an object, that will serve a
request? Would this prevent sharing the object?

-- 
Filip Gruszczyński

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to