Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #28161 > unrolled thread
| Started by | Mulla <mullapervez@gmail.com> |
|---|---|
| First post | 2012-08-31 01:40 -0700 |
| Last post | 2012-08-31 02:31 -0700 |
| Articles | 5 — 3 participants |
Back to article view | Back to comp.lang.python
Call perl to store data in DB Mulla <mullapervez@gmail.com> - 2012-08-31 01:40 -0700
Re: Call perl to store data in DB Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-08-31 10:11 +0100
Re: Call perl to store data in DB "Octavian Rasnita" <orasnita@gmail.com> - 2012-08-31 12:19 +0300
Re: Call perl to store data in DB Mulla <mullapervez@gmail.com> - 2012-08-31 02:31 -0700
Re: Call perl to store data in DB Mulla <mullapervez@gmail.com> - 2012-08-31 02:31 -0700
| From | Mulla <mullapervez@gmail.com> |
|---|---|
| Date | 2012-08-31 01:40 -0700 |
| Subject | Call perl to store data in DB |
| Message-ID | <407771a5-0b1f-4bb6-8548-e5f79908b43d@googlegroups.com> |
hey,
when i submit the form in html , the entered data (fname,lanme,uname.....)all have to come in perl script to store that data in DB.
Python View.py
def ProfileRegistration(request):
if request.user.is_authenticated():
return HttpResponseRedirect('/profile/')
if request.method == 'POST':
form = RegistrationForm(data=request.POST, files=request.FILES)
if form.is_bound and form.is_valid():
user = User.objects.create_user(username=form.cleaned_data['username'],
email=form.cleaned_data['email'],
password=form.cleaned_data['password'],)
new_user= user.save()
profile = Profile(user=user,firstname=form.cleaned_data['firstname'],
lastname=form.cleaned_data['lastname'],
telephone=form.cleaned_data['telephone'],
service=form.cleaned_data['service'],
servicetype=form.cleaned_data['servicetype'],)
new_user = profile.save()
# messages.info(request, "Thank you for registration.Please login to continue")
# login(request, new_user)
return HttpResponseRedirect('/dashboard/')
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))
Below in my perl script
#!/usr/bin/perl
use strict;
use warnings;
use user;
my $tempuser = new user ();
if ($tempuser->readbyfirstname('Pervez') eq 1) {
# Continue processing since we found a match
if($tempuser->{lastname} eq 'Noel')
{
print "Name already exists, \n";
}
}
my $tempuser1 = new user();
$tempuser1->readbyemail_id('mullapervez@gmail.com');
if($tempuser1->{email_id} eq 'mullapervez@gmail.com')
{
print "email_id is in use \n";
}
my $tempuser2 = new user();
$tempuser2->readbyusername('Tim_sir');
if ($tempuser2->{username} eq 'Mulla')
{
print "username is already present\n";
}
else {
print "we have no match\n";
}
my $tempuser4 = new user('pervez', '', 'mulla', 'mullapervez@gmail.com', '193274198');
my $string = $tempuser4->{firstname};
my @c = split(//, $string);
my $userhash = "00$c[0]$c[-1]";
print "$userhash \n";
#$tempuser4->{userhash} = $userhash;
$tempuser4->setuserhash( "$userhash" );
$tempuser4->write;
when I submit data , that data must come in place "my $tempuser4 = new user('pervez', '', 'mulla', 'mullapervez@gmail.com', '193274198');" ...
how can I do this ...>>?
Look forward for hear from you soon
Thank You
[toc] | [next] | [standalone]
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Date | 2012-08-31 10:11 +0100 |
| Message-ID | <mailman.4001.1346404237.4697.python-list@python.org> |
| In reply to | #28161 |
On 31/08/2012 09:40, Mulla wrote: [snip] > how can I do this ...>>? > > Look forward for hear from you soon > > Thank You > Search the archives as it's the fourth time the question has been asked within a few weeks. -- Cheers. Mark Lawrence.
[toc] | [prev] | [next] | [standalone]
| From | "Octavian Rasnita" <orasnita@gmail.com> |
|---|---|
| Date | 2012-08-31 12:19 +0300 |
| Message-ID | <mailman.4002.1346404771.4697.python-list@python.org> |
| In reply to | #28161 |
Maybe I didn't understand well, but if you want your Perl program to get and store the data submitted by the form, then the action of the form should point to the Perl script something like:
<form action="/path/to/your/Perl/script.pl" method="post">
So your "form" object in Python should set the action as the path to the Perl program.
--Octavian
----- Original Message -----
From: "Mulla" <mullapervez@gmail.com>
Newsgroups: comp.lang.python
To: <python-list@python.org>
Sent: Friday, August 31, 2012 11:40 AM
Subject: Call perl to store data in DB
> hey,
>
> when i submit the form in html , the entered data (fname,lanme,uname.....)all have to come in perl script to store that data in DB.
>
>
> Python View.py
>
>
> def ProfileRegistration(request):
> if request.user.is_authenticated():
> return HttpResponseRedirect('/profile/')
> if request.method == 'POST':
> form = RegistrationForm(data=request.POST, files=request.FILES)
> if form.is_bound and form.is_valid():
> user = User.objects.create_user(username=form.cleaned_data['username'],
> email=form.cleaned_data['email'],
> password=form.cleaned_data['password'],)
> new_user= user.save()
> profile = Profile(user=user,firstname=form.cleaned_data['firstname'],
> lastname=form.cleaned_data['lastname'],
> telephone=form.cleaned_data['telephone'],
> service=form.cleaned_data['service'],
> servicetype=form.cleaned_data['servicetype'],)
> new_user = profile.save()
> # messages.info(request, "Thank you for registration.Please login to continue")
> # login(request, new_user)
> return HttpResponseRedirect('/dashboard/')
> 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))
>
> Below in my perl script
>
>
> #!/usr/bin/perl
>
> use strict;
> use warnings;
> use user;
>
>
>
> my $tempuser = new user ();
>
> if ($tempuser->readbyfirstname('Pervez') eq 1) {
> # Continue processing since we found a match
> if($tempuser->{lastname} eq 'Noel')
> {
> print "Name already exists, \n";
> }
> }
>
> my $tempuser1 = new user();
> $tempuser1->readbyemail_id('mullapervez@gmail.com');
> if($tempuser1->{email_id} eq 'mullapervez@gmail.com')
> {
> print "email_id is in use \n";
> }
>
>
>
> my $tempuser2 = new user();
> $tempuser2->readbyusername('Tim_sir');
> if ($tempuser2->{username} eq 'Mulla')
> {
> print "username is already present\n";
> }
> else {
> print "we have no match\n";
> }
>
> my $tempuser4 = new user('pervez', '', 'mulla', 'mullapervez@gmail.com', '193274198');
> my $string = $tempuser4->{firstname};
> my @c = split(//, $string);
> my $userhash = "00$c[0]$c[-1]";
> print "$userhash \n";
> #$tempuser4->{userhash} = $userhash;
> $tempuser4->setuserhash( "$userhash" );
> $tempuser4->write;
>
>
> when I submit data , that data must come in place "my $tempuser4 = new user('pervez', '', 'mulla', 'mullapervez@gmail.com', '193274198');" ...
>
> how can I do this ...>>?
>
> Look forward for hear from you soon
>
> Thank You
> --
> http://mail.python.org/mailman/listinfo/python-list
[toc] | [prev] | [next] | [standalone]
| From | Mulla <mullapervez@gmail.com> |
|---|---|
| Date | 2012-08-31 02:31 -0700 |
| Message-ID | <02ea1888-7287-4ec4-b47c-04e2e316cd45@googlegroups.com> |
| In reply to | #28163 |
On Friday, August 31, 2012 2:49:32 PM UTC+5:30, Octavian Rasnita wrote:
> Maybe I didn't understand well, but if you want your Perl program to get and store the data submitted by the form, then the action of the form should point to the Perl script something like:
>
>
>
> <form action="/path/to/your/Perl/script.pl" method="post">
>
>
>
> So your "form" object in Python should set the action as the path to the Perl program.
>
>
>
> --
> Octavian
>
>
> ----- Original Message -----
>
> From: "Mulla" <mullapervez@gmail.com>
>
> Newsgroups: comp.lang.python
>
> To: <python-list@python.org>
>
> Sent: Friday, August 31, 2012 11:40 AM
>
> Subject: Call perl to store data in DB
>
>
>
>
>
> > hey,
>
> >
>
> > when i submit the form in html , the entered data (fname,lanme,uname.....)all have to come in perl script to store that data in DB.
>
> >
>
> >
>
> > Python View.py
>
> >
>
> >
>
> > def ProfileRegistration(request):
>
> > if request.user.is_authenticated():
>
> > return HttpResponseRedirect('/profile/')
>
> > if request.method == 'POST':
>
> > form = RegistrationForm(data=request.POST, files=request.FILES)
>
> > if form.is_bound and form.is_valid():
>
> > user = User.objects.create_user(username=form.cleaned_data['username'],
>
> > email=form.cleaned_data['email'],
>
> > password=form.cleaned_data['password'],)
>
> > new_user= user.save()
>
> > profile = Profile(user=user,firstname=form.cleaned_data['firstname'],
>
> > lastname=form.cleaned_data['lastname'],
>
> > telephone=form.cleaned_data['telephone'],
>
> > service=form.cleaned_data['service'],
>
> > servicetype=form.cleaned_data['servicetype'],)
>
> > new_user = profile.save()
>
> > # messages.info(request, "Thank you for registration.Please login to continue")
>
> > # login(request, new_user)
>
> > return HttpResponseRedirect('/dashboard/')
>
> > 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))
>
> >
>
> > Below in my perl script
>
> >
>
> >
>
> > #!/usr/bin/perl
>
> >
>
> > use strict;
>
> > use warnings;
>
> > use user;
>
> >
>
> >
>
> >
>
> > my $tempuser = new user ();
>
> >
>
> > if ($tempuser->readbyfirstname('Pervez') eq 1) {
>
> > # Continue processing since we found a match
>
> > if($tempuser->{lastname} eq 'Noel')
>
> > {
>
> > print "Name already exists, \n";
>
> > }
>
> > }
>
> >
>
> > my $tempuser1 = new user();
>
> > $tempuser1->readbyemail_id('mullapervez@gmail.com');
>
> > if($tempuser1->{email_id} eq 'mullapervez@gmail.com')
>
> > {
>
> > print "email_id is in use \n";
>
> > }
>
> >
>
> >
>
> >
>
> > my $tempuser2 = new user();
>
> > $tempuser2->readbyusername('Tim_sir');
>
> > if ($tempuser2->{username} eq 'Mulla')
>
> > {
>
> > print "username is already present\n";
>
> > }
>
> > else {
>
> > print "we have no match\n";
>
> > }
>
> >
>
> > my $tempuser4 = new user('pervez', '', 'mulla', 'mullapervez@gmail.com', '193274198');
>
> > my $string = $tempuser4->{firstname};
>
> > my @c = split(//, $string);
>
> > my $userhash = "00$c[0]$c[-1]";
>
> > print "$userhash \n";
>
> > #$tempuser4->{userhash} = $userhash;
>
> > $tempuser4->setuserhash( "$userhash" );
>
> > $tempuser4->write;
>
> >
>
> >
>
> > when I submit data , that data must come in place "my $tempuser4 = new user('pervez', '', 'mulla', 'mullapervez@gmail.com', '193274198');" ...
>
> >
>
> > how can I do this ...>>?
>
> >
>
> > Look forward for hear from you soon
>
> >
>
> > Thank You
>
> > --
>
> > http://mail.python.org/mailman/listinfo/python-list
Thank You Octavian
[toc] | [prev] | [next] | [standalone]
| From | Mulla <mullapervez@gmail.com> |
|---|---|
| Date | 2012-08-31 02:31 -0700 |
| Message-ID | <mailman.4003.1346405524.4697.python-list@python.org> |
| In reply to | #28163 |
On Friday, August 31, 2012 2:49:32 PM UTC+5:30, Octavian Rasnita wrote:
> Maybe I didn't understand well, but if you want your Perl program to get and store the data submitted by the form, then the action of the form should point to the Perl script something like:
>
>
>
> <form action="/path/to/your/Perl/script.pl" method="post">
>
>
>
> So your "form" object in Python should set the action as the path to the Perl program.
>
>
>
> --
> Octavian
>
>
> ----- Original Message -----
>
> From: "Mulla" <mullapervez@gmail.com>
>
> Newsgroups: comp.lang.python
>
> To: <python-list@python.org>
>
> Sent: Friday, August 31, 2012 11:40 AM
>
> Subject: Call perl to store data in DB
>
>
>
>
>
> > hey,
>
> >
>
> > when i submit the form in html , the entered data (fname,lanme,uname.....)all have to come in perl script to store that data in DB.
>
> >
>
> >
>
> > Python View.py
>
> >
>
> >
>
> > def ProfileRegistration(request):
>
> > if request.user.is_authenticated():
>
> > return HttpResponseRedirect('/profile/')
>
> > if request.method == 'POST':
>
> > form = RegistrationForm(data=request.POST, files=request.FILES)
>
> > if form.is_bound and form.is_valid():
>
> > user = User.objects.create_user(username=form.cleaned_data['username'],
>
> > email=form.cleaned_data['email'],
>
> > password=form.cleaned_data['password'],)
>
> > new_user= user.save()
>
> > profile = Profile(user=user,firstname=form.cleaned_data['firstname'],
>
> > lastname=form.cleaned_data['lastname'],
>
> > telephone=form.cleaned_data['telephone'],
>
> > service=form.cleaned_data['service'],
>
> > servicetype=form.cleaned_data['servicetype'],)
>
> > new_user = profile.save()
>
> > # messages.info(request, "Thank you for registration.Please login to continue")
>
> > # login(request, new_user)
>
> > return HttpResponseRedirect('/dashboard/')
>
> > 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))
>
> >
>
> > Below in my perl script
>
> >
>
> >
>
> > #!/usr/bin/perl
>
> >
>
> > use strict;
>
> > use warnings;
>
> > use user;
>
> >
>
> >
>
> >
>
> > my $tempuser = new user ();
>
> >
>
> > if ($tempuser->readbyfirstname('Pervez') eq 1) {
>
> > # Continue processing since we found a match
>
> > if($tempuser->{lastname} eq 'Noel')
>
> > {
>
> > print "Name already exists, \n";
>
> > }
>
> > }
>
> >
>
> > my $tempuser1 = new user();
>
> > $tempuser1->readbyemail_id('mullapervez@gmail.com');
>
> > if($tempuser1->{email_id} eq 'mullapervez@gmail.com')
>
> > {
>
> > print "email_id is in use \n";
>
> > }
>
> >
>
> >
>
> >
>
> > my $tempuser2 = new user();
>
> > $tempuser2->readbyusername('Tim_sir');
>
> > if ($tempuser2->{username} eq 'Mulla')
>
> > {
>
> > print "username is already present\n";
>
> > }
>
> > else {
>
> > print "we have no match\n";
>
> > }
>
> >
>
> > my $tempuser4 = new user('pervez', '', 'mulla', 'mullapervez@gmail.com', '193274198');
>
> > my $string = $tempuser4->{firstname};
>
> > my @c = split(//, $string);
>
> > my $userhash = "00$c[0]$c[-1]";
>
> > print "$userhash \n";
>
> > #$tempuser4->{userhash} = $userhash;
>
> > $tempuser4->setuserhash( "$userhash" );
>
> > $tempuser4->write;
>
> >
>
> >
>
> > when I submit data , that data must come in place "my $tempuser4 = new user('pervez', '', 'mulla', 'mullapervez@gmail.com', '193274198');" ...
>
> >
>
> > how can I do this ...>>?
>
> >
>
> > Look forward for hear from you soon
>
> >
>
> > Thank You
>
> > --
>
> > http://mail.python.org/mailman/listinfo/python-list
Thank You Octavian
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web