Message from discussion
Strange behaviour after pressing on button
Received: by 10.50.182.132 with SMTP id ee4mr1351384igc.5.1351258225827;
Fri, 26 Oct 2012 06:30:25 -0700 (PDT)
X-BeenThere: django-users@googlegroups.com
Received: by 10.42.200.69 with SMTP id ev5ls9095469icb.5.gmail; Fri, 26 Oct
2012 06:29:56 -0700 (PDT)
Received: by 10.50.181.233 with SMTP id dz9mr622259igc.1.1351258196028;
Fri, 26 Oct 2012 06:29:56 -0700 (PDT)
Received: by 10.50.181.233 with SMTP id dz9mr622258igc.1.1351258195973;
Fri, 26 Oct 2012 06:29:55 -0700 (PDT)
Return-Path: <kurtis.mull...@gmail.com>
Received: from mail-ob0-f182.google.com (mail-ob0-f182.google.com [209.85.214.182])
by gmr-mx.google.com with ESMTPS id d5si1244751iga.1.2012.10.26.06.29.55
(version=TLSv1/SSLv3 cipher=OTHER);
Fri, 26 Oct 2012 06:29:55 -0700 (PDT)
Received-SPF: pass (google.com: domain of kurtis.mull...@gmail.com designates 209.85.214.182 as permitted sender) client-ip=209.85.214.182;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of kurtis.mull...@gmail.com designates 209.85.214.182 as permitted sender) smtp.mail=kurtis.mull...@gmail.com; dkim=pass header...@gmail.com
Received: by mail-ob0-f182.google.com with SMTP id wc20so4563279obb.27
for <django-users@googlegroups.com>; Fri, 26 Oct 2012 06:29:55 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20120113;
h=mime-version:in-reply-to:references:date:message-id:subject:from:to
:content-type;
bh=z3iZP1cVnCwQUe0+9ocHWcj/qR7sJ8xI6uBYFqWWsfw=;
b=DPvYURpra+0aHEIDrCCHTzu2XRCZs87kyrRrxOfXU5IyDicyXDvpPrXijAzALXF6Dh
QpWNtjd1bR0vwWPU78rXsc27j36wtb0AmtJHObJhPl+d15CrIpNaX2ijuqP1hh7fCEDn
xR84/O7CbIzenig86YdLOKm9NQoiSJP1fOsH+9+y/pL+2wFCXinUTWuZol+eKqou/3mX
XPXe9C2IM9DlzmrUlRcDAFDgqwsF7yBXxZyZAEyLOr5O53cBnRjLuK8xUznj06d8bTzX
MMjKZ7fb27MjVTePp5lsgb+pFfNFrEyLAKUvPBLgnE6ECIeoMeclI2i++GErt+ip5EIL
r8xA==
MIME-Version: 1.0
Received: by 10.60.32.137 with SMTP id j9mr20065486oei.133.1351258195773; Fri,
26 Oct 2012 06:29:55 -0700 (PDT)
Received: by 10.182.155.4 with HTTP; Fri, 26 Oct 2012 06:29:55 -0700 (PDT)
In-Reply-To: <a62abd80-78e0-44d1-826f-5c678e491...@10g2000vbu.googlegroups.com>
References: <2bc1d93e-9788-4b28-ab18-637ebe15e...@k21g2000vbj.googlegroups.com>
<50881CF5.7020...@consbio.org>
<4cabea45-3752-4d40-9290-ea4b224d6...@k21g2000vbj.googlegroups.com>
<50895973.5040...@consbio.org>
<a62abd80-78e0-44d1-826f-5c678e491...@10g2000vbu.googlegroups.com>
Date: Fri, 26 Oct 2012 09:29:55 -0400
Message-ID: <CAPbEHsd5-txBfuQPbnuYXWDR47bwJvZ62VLrN6cHFxJVkrG...@mail.gmail.com>
Subject: Re: Strange behaviour after pressing on button
From: Kurtis Mullins <kurtis.mull...@gmail.com>
To: django-users@googlegroups.com
Content-Type: multipart/alternative; boundary=e89a8fb1ec56c248f804ccf65014
--e89a8fb1ec56c248f804ccf65014
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Just to give you a hint, you'll need to do 2 things:
1. Use {% csrf_token %} in your view to generate the CSRF Token Form Field
2. Include the value and name from that Form Field in your Javascript
Request
#2 is much more a Javascript issue; not specific to django. although
someone here may help you.
Good luck
On Fri, Oct 26, 2012 at 5:16 AM, Stone <phrac...@gmail.com> wrote:
> Hi Nik,
>
> I do not understand. How can I submitted as a actual form parameter?
> Are there any examples?
>
> On Oct 25, 5:24 pm, Nikolas Stevenson-Molnar <nik.mol...@consbio.org>
> wrote:
> > It looks like you're submitting your request via AJAX and using the
> > X-CSRFToken header. It's very possible that one of your proxies isn't
> > forwarding that header correctly. You might try submitting it as an
> > actual form parameter instead.
> >
> > _Nik
> >
> > On 10/25/2012 6:01 AM, Stone wrote:
> >
> >
> >
> >
> >
> >
> >
> > > Over Firefox and Firebug I have received that CSRF Validation failed.
> > > My server is running on apache2-2.2.22 and there are two proxy's
> > > All template file and forms includes csrf_token tag.
> >
> > > On Oct 24, 6:54 pm, Nikolas Stevenson-Molnar <nik.mol...@consbio.org>
> > > wrote:
> > >> It's possible that the CSRF token isn't being sent correctly. As a
> test,
> > >> try adding the @csrf_exempt decorator to your view. If you no longer
> get
> > >> the 403, then it's a CSRF problem.
> >
> > >> _Nik
> >
> > >> On 10/24/2012 6:31 AM, Stone wrote:
> >
> > >>> My Django application is running on real server (apache2-2.2.22).
> > >>> In urls.py is mentioned:
> > >>> (r'^configSave/$', configSave),
> > >>> My HTML is bellow. After pressing on configSave I am receiving HTTP
> > >>> 403 error page.
> > >>> In view.py is mentioned:
> > >>> def configSave(request):
> > >>> configFile=3D{}
> > >>> if os.path.isfile(SSO_CONF) !=3D False:
> > >>> f =3D open(SSO_CONF,"r")
> > >>> for line in f:
> > >>> line =3D line.strip()
> > >>> if re.search('^#',line) !=3D None:
> > >>> '''print 'This is the commentary'''
> > >>> else:
> > >>> '''print line'''
> > >>> try:
> > >>> name, value =3D line.split('=3D'=
,2)
> > >>> configFile[name]=3Dvalue
> > >>> print '<%s>%s</%s>' % (name,
> value, name)
> > >>> except ValueError, err:
> > >>> ''' print 'This is empty row'''
> > >>>
> configFile['SlaveDeactAppl']=3DconfigFile['SlaveDeactAppl'].split(',');
> > >>>
> configFile['SlaveDeactScripts']=3DconfigFile['SlaveDeactScripts'].split('=
,');
> > >>> configFile=3D{}
> > >>> if os.path.isfile(SSO_CONF) !=3D False:
> > >>> f =3D open(SSO_CONF,"r")
> > >>> for line in f:
> > >>> line =3D line.strip()
> > >>> if re.search('^#',line) !=3D None:
> > >>> '''print 'This is the commentary'''
> > >>> else:
> > >>> '''print line'''
> > >>> try:
> > >>> name, value =3D line.split('=3D'=
,2)
> > >>> configFile[name]=3Dvalue
> > >>> print '<%s>%s</%s>' % (name,
> value, name)
> > >>> except ValueError, err:
> > >>> ''' print 'This is empty row'''
> > >>>
> configFile['SlaveDeactAppl']=3DconfigFile['SlaveDeactAppl'].split(',');
> > >>>
> configFile['SlaveDeactScripts']=3DconfigFile['SlaveDeactScripts'].split('=
,');
> > >>> c =3D {}
> > >>> c =3D Context({
> > >>> 'config':configFile,
> > >>> 'item':2,
> > >>> })
> > >>> c.update(csrf(request))
> > >>> return
> > >>>
> render_to_response('config.html',c,context_instance=3DRequestContext(requ=
est))
> > >>> By the way how to really fast define logging mechanism which can be
> > >>> use for debugging.
> > >>> Is this my programmer approach corrector is there any other way how
> to
> > >>> react on the pressing of button?
> > >>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://
> > >>>www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> > >>> {% extends "index.html" %}
> > >>> {% block content %}
> > >>> <html lang=3D"en-US" xml:lang=3D"en-US" xmlns=3D"http://www.w3.org/=
1999/
> > >>> xhtml">
> > >>> <script type=3D"text/javascript">
> > >>> top.helpID=3D"SSO_config";
> > >>> $(document).ready(function () {
> > >>> function sendAjax()
> > >>> {
> > >>> $(document).ajaxSend(function(event, xhr, settings) {
> > >>> function getCookie(name) {
> > >>> var cookieValue =3D null;
> > >>> if (document.cookie && document.cookie !=3D '') {
> > >>> var cookies =3D document.cookie.split(';');
> > >>> for (var i =3D 0; i < cookies.length; i++) {
> > >>> var cookie =3D jQuery.trim(cookies[i]);
> > >>> if (cookie.substring(0, name.length + 1) =3D=
=3D
> (name
> > >>> + '=3D')) {
> > >>> cookieValue =3D
> > >>> decodeURIComponent(cookie.substring(name.length + 1));
> > >>> break;
> > >>> }
> > >>> }
> > >>> }
> > >>> return cookieValue;
> > >>> }
> > >>> function sameOrigin(url) {
> > >>> var host =3D document.location.host; // host + port
> > >>> var protocol =3D document.location.protocol;
> > >>> var sr_origin =3D '//' + host;
> > >>> var origin =3D protocol + sr_origin;
> > >>> // Allow absolute or scheme relative URLs to same
> origin
> > >>> return (url =3D=3D origin || url.slice(0, origin.len=
gth +
> 1)
> > >>> =3D=3D origin + '/') ||
> > >>> (url =3D=3D sr_origin || url.slice(0,
> sr_origin.length +
> > >>> 1) =3D=3D sr_origin + '/') ||
> > >>> !(/^(\/\/|http:|https:).*/.test(url));
> > >>> }
> > >>> function safeMethod(method) {
> > >>> return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
> > >>> }
> > >>> if (!safeMethod(settings.type) &&
> sameOrigin(settings.url)) {
> > >>> xhr.setRequestHeader("X-CSRFToken",
> > >>> getCookie('csrftoken'));
> > >>> }
> > >>> });
> > >>> }
> > >>> $("#saveCfg").click(function(event){
> > >>> sendAjax();
> > >>> $.ajax({
> > >>> type: "POST",
> > >>> url: "/SSO/configSave/",
> > >>> dataType: "text",
> > >>> success: function(data) {
> > >>> alert(data);
> > >>> },
> > >>> error: function(xhr,ajaxOptions,thrownError) {
> > >>> alert(xhr.status +" "+xhr.statusText);
> > >>> alert(thrownError);
> > >>> }
> > >>> });
> > >>> });
> > >>> });
> > >>> </script>
> > >>> <body class=3D"bodyClass">
> > >>> <table class=3D"body_table">
> > >>> <tr>
> > >>> <th colspan=3D"4" class=3D"thead"><b> IP configuration=
</b></
> > >>> th>
> > >>> </tr>
> > >>> <tr>
> > >>> <td>Master IP address</td>
> > >>> <td>
> > >>> <input id=3D"mip" style=3D"width: 100px;"
> > >>> value=3D"{{config.MasterIPAddress}}"/>
> > >>> </td>
> > >>> <td>Slave IP address</td>
> > >>> <td>
> > >>> <input id=3D"sip" style=3D"width: 100px;"
> > >>> value=3D"{{config.SlaveIPAddress}}"/>
> > >>> </td>
> > >>> </tr>
> > >>> <tr>
> > >>> <td>Master netmask</td>
> > >>> <td>
> > >>> <input id=3D"mnetmask" style=3D"width: 100px;"
> > >>> value=3D"{{config.MasterIPNetmask}}"/>
> > >>> </td>
> > >>> <td>Slave netmask</td>
> > >>> <td>
> > >>> <input id=3D"snetmask" style=3D"width: 100px;"
> > >>> value=3D"{{config.SlaveIPNetmask}}"/>
> > >>> </td>
> > >>> </tr>
> > >>> <tr>
> > >>> <td>Master broadcast</td>
> > >>> <td>
> > >>> <input id=3D"mbroadcast" style=3D"width: 100px;"
> > >>> value=3D"{{config.MasterIPBroadcast}}"/>
> > >>> </td>
> > >>> <td>Slave broadcast</td>
> > >>> <td>
> > >>> <input id=3D"sbroadcast" style=3D"width: 100px;"
> > >>> value=3D"{{config.SlaveIPBroadcast}}"/>
> > >>> </td>
> > >>> </tr>
> > >>> <tr>
> > >>> <td></td>
> > >>> <td></td>
> > >>> <td></td>
> > >>> <td></td>
> > >>> </tr>
> > >>> <tr>
> > >>> <td>Lancard name</td>
> > >>> <td><span id=3D"cardname"></span>{{config.LanCardName}}</td=
>
> > >>> <td>MAC address</td>
> > >>> <td><input id=3D"cardmac" value=3D"{{config.LanCardMAC}}"/>=
</td>
> > >>> </tr>
> > >>> <tr>
> > >>> <th colspan=3D"4" class=3D"thead"><b> Configuration
> > >>> parameters</b>
> > >>> </th>
> > >>> </tr>
> > >>> <tr>
> > >>> <td>Replication frequency</td>
> > >>> <td>
> > >>> <select id=3D"freq">
> > >>> <option {% if
> config.MasterBackupFrequency =3D "daily" %}
> > >>> selected=3D"selected"{% endif %}>daily</option>
> > >>> <option {% if
> config.MasterBackupFrequency =3D "Monday" %}
> > >>> selected=3D"selected"{% endif %}>Monday</option>
> > >>> <option {% if
> config.MasterBackupFrequency =3D "Thusday" %}
> > >>> selected=3D"selected"{% endif %}>Thusday</option>
> > >>> <option {% if
> config.MasterBackupFrequency =3D "Wednesday" %}
> > >>> selected=3D"selected"{% endif %}>Wednesday</option>
> > >>> <option {% if
> config.MasterBackupFrequency =3D "Thursday" %}
> > >>> selected=3D"selected"{% endif %}>Thursday</option>
> > >>> <option {% if
> config.MasterBackupFrequency =3D "Friday" %}
> > >>> selected=3D"selected"{% endif %}>Friday</option>
> > >>> <option {% if
> config.MasterBackupFrequency =3D "Saturday" %}
> > >>> selected=3D"selected"{% endif %}>Saturday</option>
> > >>> <option {% if
> config.MasterBackupFrequency =3D "Sunday" %}
> > >>> selected=3D"selected"{% endif %}>Sunday</option>
> > >>> </select>
> > >>> </td>
> > >>> <td>Replication time</td>
> > >>> <td><input style=3D"width: 40%;" id=3D"backuptime"
> > >>> value=3D"{{config.MasterBackupStartTime}}"/></td>
> > >>> </tr>
> > >>> <tr>
> > >>> <td valign=3D"top">Slave deactivated application</td>
> > >>> <td style=3D"width: 20%;"><span id=3D"appl">
> > >>> {% for appl in config.SlaveDeactAppl %}
> > >>> {{ appl }}<br>
> > >>> {% endfor %}
> > >>> </span></td>
> > >>> <td valign=3D"top">Slave deactivated scripts</td>
> > >>> <td style=3D"width: 20%;"><span
> >
> > ...
> >
> > read more =BB
>
> --
> 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+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=3Den.
>
>
--e89a8fb1ec56c248f804ccf65014
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Just to give you a hint, you'll need to do 2 things:<div><br></div><div=
>1. Use {% csrf_token %} in your view to generate the CSRF Token Form Field=
</div><div>2. Include the value and name from that Form Field in your Javas=
cript Request</div>
<div><br></div><div>#2 is much more a Javascript issue; not specific to dja=
ngo. although someone here may help you.</div><div><br></div><div>Good luck=
<br><br><div class=3D"gmail_quote">On Fri, Oct 26, 2012 at 5:16 AM, Stone <=
span dir=3D"ltr"><<a href=3D"mailto:phrac...@gmail.com" target=3D"_blank=
">phrac...@gmail.com</a>></span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">Hi Nik,<br>
<br>
I do not understand. How can I submitted as a actual form parameter?<br>
Are there any examples?<br>
<br>
On Oct 25, 5:24=A0pm, Nikolas Stevenson-Molnar <<a href=3D"mailto:nik.mo=
l...@consbio.org">nik.mol...@consbio.org</a>><br>
<div><div class=3D"h5">wrote:<br>
> It looks like you're submitting your request via AJAX and using th=
e<br>
> X-CSRFToken header. It's very possible that one of your proxies is=
n't<br>
> forwarding that header correctly. You might try submitting it as an<br=
>
> actual form parameter instead.<br>
><br>
> _Nik<br>
><br>
> On 10/25/2012 6:01 AM, Stone wrote:<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> > Over Firefox and Firebug I have received that CSRF Validation fai=
led.<br>
> > My server is running on apache2-2.2.22 and there are two proxy=
9;s<br>
> > All template file and forms includes csrf_token tag.<br>
><br>
> > On Oct 24, 6:54 pm, Nikolas Stevenson-Molnar <<a href=3D"mailt=
o:nik.mol...@consbio.org">nik.mol...@consbio.org</a>><br>
> > wrote:<br>
> >> It's possible that the CSRF token isn't being sent co=
rrectly. As a test,<br>
> >> try adding the @csrf_exempt decorator to your view. If you no=
longer get<br>
> >> the 403, then it's a CSRF problem.<br>
><br>
> >> _Nik<br>
><br>
> >> On 10/24/2012 6:31 AM, Stone wrote:<br>
><br>
> >>> My Django application is running on real server (apache2-=
2.2.22).<br>
> >>> In urls.py is mentioned:<br>
> >>> =A0 =A0 (r'^configSave/$', configSave),<br>
> >>> My HTML is bellow. After pressing on configSave I am rece=
iving HTTP<br>
> >>> 403 error page.<br>
> >>> In view.py is mentioned:<br>
> >>> def configSave(request):<br>
> >>> =A0 =A0configFile=3D{}<br>
> >>> =A0 =A0if os.path.isfile(SSO_CONF) !=3D False:<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0f =3D open(SSO_CONF,"r")=
<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0for line in f:<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0line =3D line.stri=
p()<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if re.search('=
^#',line) !=3D None:<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0&#=
39;''print 'This is the commentary'''<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0else:<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0&#=
39;''print line'''<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0tr=
y:<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0name, value =3D line.split('=3D',2)<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0configFile[name]=3Dvalue<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0print '<%s>%s</%s>' % (name, value, name=
)<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ex=
cept ValueError, err:<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0''' print 'This is empty row'''<=
br>
> >>> =A0 =A0configFile['SlaveDeactAppl']=3DconfigFile[=
'SlaveDeactAppl'].split(',');<br>
> >>> configFile['SlaveDeactScripts']=3DconfigFile['=
;SlaveDeactScripts'].split(',');<br>
> >>> =A0 =A0configFile=3D{}<br>
> >>> =A0 =A0if os.path.isfile(SSO_CONF) !=3D False:<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0f =3D open(SSO_CONF,"r")=
<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0for line in f:<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0line =3D line.stri=
p()<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if re.search('=
^#',line) !=3D None:<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0&#=
39;''print 'This is the commentary'''<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0else:<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0&#=
39;''print line'''<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0tr=
y:<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0name, value =3D line.split('=3D',2)<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0configFile[name]=3Dvalue<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0print '<%s>%s</%s>' % (name, value, name=
)<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ex=
cept ValueError, err:<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0''' print 'This is empty row'''<=
br>
> >>> =A0 =A0configFile['SlaveDeactAppl']=3DconfigFile[=
'SlaveDeactAppl'].split(',');<br>
> >>> configFile['SlaveDeactScripts']=3DconfigFile['=
;SlaveDeactScripts'].split(',');<br>
> >>> =A0 =A0c =3D {}<br>
> >>> =A0 =A0c =3D Context({<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0'config':configFile,<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0'item':2,<br>
> >>> =A0 =A0})<br>
> >>> =A0 =A0c.update(csrf(request))<br>
> >>> =A0 =A0return<br>
> >>> render_to_response('config.html',c,context_instan=
ce=3DRequestContext(request))<br>
> >>> By the way how to really fast define logging mechanism wh=
ich can be<br>
> >>> use for debugging.<br>
> >>> Is this my programmer approach corrector is there any oth=
er way how to<br>
> >>> react on the pressing of button?<br>
> >>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Tran=
sitional//EN" "http://<br>
> >>><a href=3D"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transiti=
onal.dtd" target=3D"_blank">www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt=
d</a>"><br>
> >>> {% extends "index.html" %}<br>
> >>> {% block content %}<br>
> >>> <html lang=3D"en-US" xml:lang=3D"en-US&=
quot; xmlns=3D"<a href=3D"http://www.w3.org/1999/" target=3D"_blank">h=
ttp://www.w3.org/1999/</a><br>
> >>> xhtml"><br>
> >>> <script type=3D"text/javascript"><br>
> >>> =A0 top.helpID=3D"SSO_config";<br>
> >>> =A0 $(document).ready(function () {<br>
> >>> =A0 =A0function sendAjax()<br>
> >>> =A0 =A0{<br>
> >>> =A0 =A0 =A0 =A0$(document).ajaxSend(function(event, xhr, =
settings) {<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0function getCookie(name) {<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0var cookieValue =3D null;<=
br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (document.cookie &&=
amp; document.cookie !=3D '') {<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0var cookies =3D do=
cument.cookie.split(';');<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0for (var i =3D 0; =
i < cookies.length; i++) {<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0var cookie=
=3D jQuery.trim(cookies[i]);<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (cookie=
.substring(0, name.length + 1) =3D=3D (name<br>
> >>> + '=3D')) {<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0co=
okieValue =3D<br>
> >>> decodeURIComponent(cookie.substring(name.length + 1));<br=
>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0br=
eak;<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0}<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0}<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0}<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return cookieValue;<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0}<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0function sameOrigin(url) {<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0var host =3D document.loca=
tion.host; // host + port<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0var protocol =3D document.=
location.protocol;<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0var sr_origin =3D '//&=
#39; + host;<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0var origin =3D protocol + =
sr_origin;<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0// Allow absolute or schem=
e relative URLs to same origin<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return (url =3D=3D origin =
|| url.slice(0, origin.length + 1)<br>
> >>> =3D=3D origin + '/') ||<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(url =3D=3D sr_ori=
gin || url.slice(0, sr_origin.length +<br>
> >>> 1) =3D=3D sr_origin + '/') ||<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0!(/^(\/\/|http:|ht=
tps:).*/.test(url));<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0}<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0function safeMethod(method) {<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return (/^(GET|HEAD|OPTION=
S|TRACE)$/.test(method));<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0}<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0if (!safeMethod(settings.type) &am=
p;& sameOrigin(settings.url)) {<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0xhr.setRequestHeader("=
;X-CSRFToken",<br>
> >>> getCookie('csrftoken'));<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0}<br>
> >>> =A0 =A0 =A0 =A0});<br>
> >>> =A0 =A0}<br>
> >>> =A0 =A0$("#saveCfg").click(function(event){<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0sendAjax();<br>
> >>> =A0 =A0 =A0 =A0 $.ajax({<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0type: "POST&q=
uot;,<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0url: "/SSO/co=
nfigSave/",<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0dataType: "te=
xt",<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 success: function(data) {<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 alert(data);<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 },<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0error: function(xh=
r,ajaxOptions,thrownError) {<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0al=
ert(xhr.status +" "+xhr.statusText);<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0al=
ert(thrownError);<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0}<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0});<br>
> >>> =A0 =A0});<br>
> >>> =A0 });<br>
> >>> </script><br>
> >>> <body class=3D"bodyClass"><br>
> >>> =A0 <table class=3D"body_table"><br>
> >>> =A0 =A0 <tr><br>
> >>> =A0 =A0 =A0 =A0 <th colspan=3D"4" class=3D&q=
uot;thead"><b>&nbsp;IP configuration</b></<br>
> >>> th><br>
> >>> =A0 =A0 </tr><br>
> >>> =A0 =A0 <tr><br>
> >>> =A0 =A0 =A0 =A0 <td>Master IP address</td><br=
>
> >>> =A0 =A0 =A0 =A0 <td><br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 <input id=3D"mip" st=
yle=3D"width: 100px;"<br>
> >>> value=3D"{{config.MasterIPAddress}}"/><br>
> >>> =A0 =A0 =A0 =A0 </td><br>
> >>> =A0 =A0 =A0 =A0 <td>Slave IP address</td><br>
> >>> =A0 =A0 =A0 =A0 <td><br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 <input id=3D"sip" st=
yle=3D"width: 100px;"<br>
> >>> value=3D"{{config.SlaveIPAddress}}"/><br>
> >>> =A0 =A0 =A0 =A0 </td><br>
> >>> =A0 =A0 </tr><br>
> >>> =A0 =A0 <tr><br>
> >>> =A0 =A0 =A0 =A0 <td>Master netmask</td><br>
> >>> =A0 =A0 =A0 =A0 <td><br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 <input id=3D"mnetmask&quo=
t; style=3D"width: 100px;"<br>
> >>> value=3D"{{config.MasterIPNetmask}}"/><br>
> >>> =A0 =A0 =A0 =A0 </td><br>
> >>> =A0 =A0 =A0 =A0 <td>Slave netmask</td><br>
> >>> =A0 =A0 =A0 =A0 <td><br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 <input id=3D"snetmask&quo=
t; style=3D"width: 100px;"<br>
> >>> value=3D"{{config.SlaveIPNetmask}}"/><br>
> >>> =A0 =A0 =A0 =A0 </td><br>
> >>> =A0 =A0 </tr><br>
> >>> =A0 =A0 <tr><br>
> >>> =A0 =A0 =A0 =A0 <td>Master broadcast</td><br>
> >>> =A0 =A0 =A0 =A0 <td><br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 <input id=3D"mbroadcast&q=
uot; style=3D"width: 100px;"<br>
> >>> value=3D"{{config.MasterIPBroadcast}}"/><br>
> >>> =A0 =A0 =A0 =A0 </td><br>
> >>> =A0 =A0 =A0 =A0 <td>Slave broadcast</td><br>
> >>> =A0 =A0 =A0 =A0 <td><br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 <input id=3D"sbroadcast&q=
uot; style=3D"width: 100px;"<br>
> >>> value=3D"{{config.SlaveIPBroadcast}}"/><br>
> >>> =A0 =A0 =A0 =A0 </td><br>
> >>> =A0 =A0 </tr><br>
> >>> =A0 =A0 <tr><br>
> >>> =A0 =A0 =A0 =A0 <td></td><br>
> >>> =A0 =A0 =A0 =A0 <td></td><br>
> >>> =A0 =A0 =A0 =A0 <td></td><br>
> >>> =A0 =A0 =A0 =A0 <td></td><br>
> >>> =A0 =A0 </tr><br>
> >>> =A0 =A0 <tr><br>
> >>> =A0 =A0 =A0 =A0 <td>Lancard name</td><br>
> >>> =A0 =A0 =A0 =A0 <td><span id=3D"cardname&qu=
ot;></span>{{config.LanCardName}}</td><br>
> >>> =A0 =A0 =A0 =A0 <td>MAC address</td><br>
> >>> =A0 =A0 =A0 =A0 <td><input id=3D"cardmac&qu=
ot; value=3D"{{config.LanCardMAC}}"/></td><br>
> >>> =A0 =A0 </tr><br>
> >>> =A0 =A0 <tr><br>
> >>> =A0 =A0 =A0 =A0 <th colspan=3D"4" class=3D&q=
uot;thead"><b>&nbsp;Configuration<br>
> >>> parameters</b><br>
> >>> =A0 =A0 =A0 =A0 </th><br>
> >>> =A0 =A0 </tr><br>
> >>> =A0 =A0<tr><br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0<td>Replication frequency<=
;/td><br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0<td><br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0<select id=3D&q=
uot;freq"><br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0&l=
t;option {% if config.MasterBackupFrequency =3D "daily" %}<br>
> >>> selected=3D"selected"{% endif %}>daily</o=
ption><br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0&l=
t;option {% if config.MasterBackupFrequency =3D "Monday" %}<br>
> >>> selected=3D"selected"{% endif %}>Monday</=
option><br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0&l=
t;option {% if config.MasterBackupFrequency =3D "Thusday" %}<br>
> >>> selected=3D"selected"{% endif %}>Thusday<=
/option><br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0&l=
t;option {% if config.MasterBackupFrequency =3D "Wednesday" %}<br=
>
> >>> selected=3D"selected"{% endif %}>Wednesday&l=
t;/option><br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0&l=
t;option {% if config.MasterBackupFrequency =3D "Thursday" %}<br>
> >>> selected=3D"selected"{% endif %}>Thursday<=
;/option><br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0&l=
t;option {% if config.MasterBackupFrequency =3D "Friday" %}<br>
> >>> selected=3D"selected"{% endif %}>Friday</=
option><br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0&l=
t;option {% if config.MasterBackupFrequency =3D "Saturday" %}<br>
> >>> selected=3D"selected"{% endif %}>Saturday<=
;/option><br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0&l=
t;option {% if config.MasterBackupFrequency =3D "Sunday" %}<br>
> >>> selected=3D"selected"{% endif %}>Sunday</=
option><br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0</select><br=
>
> >>> =A0 =A0 =A0 =A0 =A0 =A0</td><br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0<td>Replication time</td&=
gt;<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0<td><input style=3D"=
width: 40%;" id=3D"backuptime"<br>
> >>> value=3D"{{config.MasterBackupStartTime}}"/>=
</td><br>
> >>> =A0 =A0</tr><br>
> >>> =A0 =A0 =A0 =A0<tr><br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0<td valign=3D"top">=
;Slave deactivated application</td><br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0<td style=3D"width: 20%;&q=
uot;><span id=3D"appl"><br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0{% for appl in con=
fig.SlaveDeactAppl %}<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0{{=
appl }}<br><br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0{% endfor %}<br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0</span></td><br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0<td valign=3D"top">=
;Slave deactivated scripts</td><br>
> >>> =A0 =A0 =A0 =A0 =A0 =A0<td style=3D"width: 20%;&q=
uot;><span<br>
><br>
</div></div>> ...<br>
><br>
> read more =BB<br>
<div class=3D"HOEnZb"><div class=3D"h5"><br>
--<br>
You received this message because you are subscribed to the Google Groups &=
quot;Django users" group.<br>
To post to this group, send email to <a href=3D"mailto:django-users@googleg=
roups.com">django-users@googlegroups.com</a>.<br>
To unsubscribe from this group, send email to <a href=3D"mailto:django-user=
s%2Bunsubscribe@googlegroups.com">django-users+unsubscribe@googlegroups.com=
</a>.<br>
For more options, visit this group at <a href=3D"http://groups.google.com/g=
roup/django-users?hl=3Den" target=3D"_blank">http://groups.google.com/group=
/django-users?hl=3Den</a>.<br>
<br>
</div></div></blockquote></div><br></div>
--e89a8fb1ec56c248f804ccf65014--