Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 Dec. 7, 2010 02:04:38

b.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

django auth for existing cgi


Is there any simple way to use django authentication/authorization to
control access to an existing (not django) cgi?

I could use subprocess.Popen to invoke the cgi after checking
authorization, but the environment needs to be set up to look like a
cgi call (setting QUERY_STRING, etc.). Is there a better way?

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

Offline

#2 Dec. 7, 2010 03:06:58

Wayne S.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

django auth for existing cgi


On Mon, Dec 6, 2010 at 4:42 PM, bc <craft.br...@gmail.com> wrote:

> Is there any simple way to use django authentication/authorization to
> control access to an existing (not django) cgi?
>
> I could use subprocess.Popen to invoke the cgi after checking
> authorization, but the environment needs to be set up to look like a
> cgi call (setting QUERY_STRING, etc.). Is there a better way?
>
>
I don't know if you could do some special trick with an HttpRequest or some
kind of redirect from one view to hit the cgi script with the automatically
created (HttpRequest) data. I'm guessing the answer is no or more trouble
than it would be worth, but that's just a guess.

I would say you really have two options.

1. Implement the script in Python, and bring it in under Django.

2. Craft your own Http Request header with Python's libraries and point it
to the cgi script.


> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@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-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#3 Dec. 7, 2010 19:49:21

Brian C.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

django auth for existing cgi


Copying things from request.META to the env parameter of Popen allows
me to get the cgi off the ground. Now I have the problem that the cgi
is generating a cookie and content type, which django returns to the
browser as page content.

Is there a way to pass it back transparently? Or, failing that, can
someone point a newbie to an appropriate method to parse the header so
it can be used to create a HttpResponse?



On Mon, Dec 6, 2010 at 7:06 PM, Wayne Smith <wayne.tuxro...@gmail.com> wrote:
>
>
> On Mon, Dec 6, 2010 at 4:42 PM, bc <craft.br...@gmail.com> wrote:
>>
>> Is there any simple way to use django authentication/authorization to
>> control access to an existing (not django) cgi?
>>
>> I could use subprocess.Popen to invoke the cgi after checking
>> authorization, but the environment needs to be set up to look like a
>> cgi call (setting QUERY_STRING, etc.). Is there a better way?
>>
>
> I don't know if you could do some special trick with an HttpRequest or some
> kind of redirect from one view to hit the cgi script with the automatically
> created (HttpRequest) data.  I'm guessing the answer is no or more trouble
> than it would be worth, but that's just a guess.
>
> I would say you really have two options.
>
> 1.  Implement the script in Python, and bring it in under Django.
>
> 2.  Craft your own Http Request header with Python's libraries and point it
> to the cgi script.
>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-us...@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.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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.
>

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

Offline

Board footer

Moderator control

Enjoy the 21st of October
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support