how to call perl script from html using python
Pervez Mulla
mullapervez at gmail.com
Thu Aug 16 03:23:05 EDT 2012
On Tuesday, August 14, 2012 10:42:48 AM UTC+5:30, Pervez Mulla wrote:
> Hi,
>
>
>
> I wanna call perl script in HTML form n store that data in DB using Python.
>
>
>
> How can i do this.......??
>
>
>
> Please help me
>
>
>
> Thank you
>
> Pervez
On Tuesday, August 14, 2012 10:42:48 AM UTC+5:30, Pervez Mulla wrote:
> Hi,
>
>
>
> I wanna call perl script in HTML form n store that data in DB using Python.
>
>
>
> How can i do this.......??
>
>
>
> Please help me
>
>
>
> Thank you
>
> Pervez
On Tuesday, August 14, 2012 10:42:48 AM UTC+5:30, Pervez Mulla wrote:
> Hi,
>
>
>
> I wanna call perl script in HTML form n store that data in DB using Python.
>
>
>
> How can i do this.......??
>
>
>
> Please help me
>
>
>
> Thank you
>
> Pervez
On Tuesday, August 14, 2012 10:42:48 AM UTC+5:30, Pervez Mulla wrote:
> Hi,
>
>
>
> I wanna call perl script in HTML form n store that data in DB using Python.
>
>
>
> How can i do this.......??
>
>
>
> Please help me
>
>
>
> Thank you
>
> Pervez
Hey Steven ,
Thank you for your response,
I will in detail now about my project,
Actually the project entire backend in PERL language , Am using Django framework for my front end .
I have written code for signup page in python , which is working perfectly .
In HTml when user submit POST method, it calling Python code ....Instead of this I wanna call perl script for sign up ......
below in form for sign up page in python ....
form.py
from django import forms
from django.contrib.auth.models import User
from django.forms import ModelForm
from user_profile.models import Profile
class RegistrationForm(ModelForm):
username = forms.CharField(label=(u'User Name'))
email = forms.EmailField(label=(u'E-mail'))
password = forms.CharField(label=(u'Password'),widget=forms.PasswordInput(render_value=False))
password1 = forms.CharField(label=(u'Verify Password'),widget=forms.PasswordInput(render_value=False))
class Meta:
model = Profile
exclude = ('user',)
def clean_username(self):
username = self.cleaned_data['username']
try:
User.objects.get(username==username)
except User.DoesNotExist:
return username
raise forms.ValidationError("That username is already taken. Please select another.")
def clean_password(self):
if self.cleaned_data['password'] != self.cleaned_data['password1']:
raise forms.ValidationError("Password didnt match... Please try again")
return self.cleaned_data
-----------------------------------------------------------------------------
view.py
def ProfileRegistration(request):
if request.user.is_authenticated():
return HttpResponseRedirect('/profile/')
if request.method =="POST":
form = RegistrationForm(request.POST)
if form.is_valid():
user = User.objects.create_user(username = form.cleaned_data['username'],
email = form.cleaned_data['email'],
password = form.cleaned_data['password'])
user.save()
profile = Profile(user=user, firstname=form.cleaned_data['firstname'],
lastname=form.cleaned_data['lastname'],
phone=form.cleaned_data['phone'],
title=form.cleaned_data['title'],
companyname=form.cleaned_data['companyname'])
profile.save()
return HttpResponseRedirect('/profile/')
else:
return render_to_response ('register.html',{'form':form},context_instance=RequestContext(request))
else:
form = RegistrationForm()
context = {'form':form}
return render_to_response('register.html', context, context_instance=RequestContext(request))
In view instead invoking python script I wanna invoke Perl script .....for the signup page
Thank You
More information about the Python-list
mailing list