os.fork inside django view bad idea?

2008-09-15 Thread shravster

Hi people,

I am running Django .96 and I have the situation, in which I need to
open a remote url using urlopen to get some information from the web.

Here is what I thought of:

Fork a new process from the view at the point where i need to perform
urlopen.
Create a pipe so that the child process can grab the write end to
wirte the results of urlopen and exit.
Meanwhile, the parent process performs all the DB lookups and misc.
operations.
Finally, before returning the response to the template use the read
end of the pipe to get the information from the child process and
render template.

But, for some reason, I get a modpython error:
Mod_python error: "PythonHandler django.core.handlers.modpython"

Traceback (most recent call last):

  File "/usr/lib64/python2.4/site-packages/mod_python/apache.py", line
299, in HandlerDispatch
result = object(req)

  File "/usr/lib/python2.4/site-packages/django/core/handlers/
modpython.py", line 177, in handler
return ModPythonHandler()(req)

  File "/usr/lib/python2.4/site-packages/django/core/handlers/
modpython.py", line 154, in __call__
response = middleware_method(request, response)

  File "/usr/lib/python2.4/site-packages/django/middleware/common.py",
line 59, in process_response
if response.status_code == 404:

AttributeError: 'NoneType' object has no attribute 'status_code'

Any ideas on how to process information in parallel from inside a
view?

Any help is greatly appreciated. Thank you!
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Manipulating URLs

2008-06-23 Thread shravster

Tons of good karma to you both :)

really appreciate it.. Thanks!

On Jun 23, 1:02 am, Tye <[EMAIL PROTECTED]> wrote:
> I knew I'd write a long, pseudo-detailed post, just to turn around and
> find something so very simple.
>
> I knew it!
>
> Thanks Matthias :-)
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Manipulating URLs

2008-06-23 Thread shravster

Hi

I am creating my first serious project with Django and looking for
ways to play around with the urls. For instance lets say a user was
sending a message to another user from (current url on the browser) "/
send_message/"  and I want to redirect the user on posting the message
to /sent_messages/ or /failed_messages/ based on the success/failure
of the send_message operation, the 2 ways I can think of are:

1) HttpResponseRedirect("/failed_messages/?status=fail=Max+message
+count+reached) #or some such thing with messy urls

2) return show_failed_messages( request, message="Fail. Max message
count reached" ) #this would still show "/send_message/" for the URL
but the template rendered would be my_messages.html

Ideal case for me would be to call the show_failed_messages (or
show_sent_messages) view function with the HttpRequest object and
extra parameters for status messages etc, but somehow show the URL on
the browser as "/my_messages/" without all the get variables.

Hope I have worded my problem right. Any help is greatly appreciated!

Thanks in Advance,
S
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



POST variable bug?

2007-07-27 Thread shravster

Hi,

Blow is a screen paste of server log for a small project I am working
on. I am just printing the httpRequests POST data.


Django version 0.96, using settings 'rsync.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
httpr.POST = 
str(httpr.POST) = 
httpr.POST.values() = ['new site', 'sefg sdfg', 'new loc']
httpr.POST.keys() = ['sitename', 'destloc', 'sloc']
httpr.POST.items() = [('sitename', 'new site'), ('destloc', 'sefg
sdfg'), ('sloc', 'new loc')]
httpr.POST['destloc'][0] = s


I am submitting a form with a multiple select field.
POST['destloc'] should be a list ['bingo', 'sefg sdfg']
instead i get only 'sefg sdfg'.

Is the mistake Django's or mine?

Thank you for your help!

--Saravana


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---