Re: Weird hyperlink issue with Office and Django authentication

2011-08-16 Thread Konstantin Sushenko
as the article says, their sessions are independent of these used by
the web server. the cookies are not shared between office sessions and
web sessions. I think django has nothing to do with it.

On Aug 16, 4:04 am, Michel30  wrote:
> Hmm the workaround MS suggests actually works, so I have a
> workaround :-)
>
> But understanding why Django's authentication backend doesn't support
> this would be good
>
> On Aug 16, 9:10 am, Michel30  wrote:
>
>
>
>
>
>
>
> > Addidtionally I found this kb article that I believe describes what is
> > going on:http://support.microsoft.com/kb/899927/en-us
>
> > On Aug 16, 8:59 am, Michel30  wrote:
>
> > > I have made a CMS-like application to store and retrieve documents
> > > using Django 1.3, mysql and Apache.
>
> > > One requirement was that only authenticated users could use it and
> > > that after closing the browser the session should be expired.
> > > So, I implemented an LDAP authentication backend, set the
> > > "SESSION_EXPIRE_AT_BROWSER_CLOSE" to True and added an @login_required
> > > decorator to functions that need it.
> > > And it is working great, just like it should.
>
> > > Until using one feature that involves clicking on a hyperlink that is
> > > supposed to open a document within the application in a browser.
> > > This again works perfectly with every browser (firefix, chrome, IE) in
> > > several flavors of versions.
> > > With working I mean the document view opens, and this is important, as
> > > long as the user was already logged in to the application he/she
> > > doesn't have to log in again.
>
> > > It is working until trying this from any office (2000/2003)
> > > application. Then suddenly logging in is required every time
> > > regardless if an session exists or not.
> > > I did some investigating and found that clicking a hyperlink in an
> > > Office application triggers three requests, and it looks like the
> > > first one is missing the session cookie.
> > > Apache log for a hyperlink in Open office:
>
> > >     172.16.3.51 - - [15/Aug/2011:11:27:29 +0200] "GET /cgi-bin/DocDB/
> > > ShowDocument?docid=20916&version=8 HTTP/1.1" 200 3603 "-" "Mozilla/5.0
> > > (Windows NT 5.1; rv:5.0) Gecko/20100101 Firefox/5.0"
>
> > > and the same document from Word:
>
> > >     172.16.3.51 - - [15/Aug/2011:11:26:09 +0200] "GET /cgi-bin/DocDB/
> > > ShowDocument?docid=20916&version=8 HTTP/1.1" 302 496 "-" "Mozilla/4.0
> > > (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR
> > > 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR
> > > 3.5.30729; .NET4.0C; .NET4.0E)"
>
> > >     172.16.3.51 - - [15/Aug/2011:11:26:09 +0200] "GET /login/?next=/
> > > cgi-bin/DocDB/ShowDocument%3Fdocid%3D20916%26version%3D8 HTTP/1.1" 200
> > > 3269 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/
> > > 4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR
> > > 3.5.30729; .NET4.0C; .NET4.0E)"
>
> > >     172.16.3.51 - - [15/Aug/2011:11:26:10 +0200] "GET /login/?next=/
> > > cgi-bin/DocDB/ShowDocument%3Fdocid%3D20916%26version%3D8 HTTP/1.1" 200
> > > 3278 "-" "Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20100101 Firefox/
> > > 5.0"
>
> > > Note the different status '200 = OK'  for OO and '302 Found' for Word.
> > > Also the length of the first returned object differ: 496 vs 3603.
>
> > > I am not sure where to point the finger to, or how to proceed and
> > > resolve it... So I'd appreciate some help a lot.
> > > Thanks,
> > > Michel

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Template html works when double clicked but empty when accessed through server

2011-08-16 Thread Konstantin Sushenko
you do not see anything because the style on your root element is set
to "display:none" and the browser does not run scripts because they
are loaded from local URLs. as it says: it is a insecure to execute
scripts from local URLs. suppose you publish this page on your
production server, where would your visitors get there scripts? they
are not on their machines in "d:/django-1.3...". basically, it is
unclear to me what you are trying to achieve.

konstantin

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Template html works when double clicked but empty when accessed through server

2011-08-15 Thread Konstantin Sushenko
I can see the markup that you published in your original post. :) what
does the browser show when you look at the page source?

konstantin

On Aug 16, 12:04 am, Adam Zedan  wrote:
> Its at the top most post..
> have a look 
> athttp://groups.google.com/group/django-users/browse_thread/thread/8a50...
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Template html works when double clicked but empty when accessed through server

2011-08-15 Thread Konstantin Sushenko
what is the source code for the blank page?

On Aug 15, 8:50 pm, Adam Zedan  wrote:
> Hi my html works properly when i double click it.
>
> The code is
>
> 
> 
>     
>         
>         Demo
>          href="file:///D:/Django-1.3/django/bin/SlickGrid/slick.grid.css"
> type="text/css" media="screen" charset="utf-8" />
>          href="file:///D:/Django-1.3/django/bin/SlickGrid/css/smoothness/jquery-ui-1.8.5.custom.css"
> type="text/css" media="screen" charset="utf-8" />
>          href="file:///D:/Django-1.3/django/bin/SlickGrid/examples/examples.css"
> type="text/css" media="screen" charset="utf-8" />
>
>          src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js";>
>          src="file:///D:/Django-1.3/django/bin/SlickGrid/lib/jquery-1.4.3.min.js">
>          src="file:///D:/Django-1.3/django/bin/SlickGrid/lib/jquery.event.drag-2.0.min.js">
>
>          src="file:///D:/Django-1.3/django/bin/SlickGrid/slick.core.js">
>          src="file:///D:/Django-1.3/django/bin/SlickGrid/slick.grid.js">
>
>         
>         var grid;
>         var columns = [
>             {id:"title", name:"Title", field:"title"},
>             {id:"duration", name:"Duration", field:"duration"},
>             {id:"%", name:"% Complete", field:"percentComplete"},
>             {id:"start", name:"Start", field:"start"},
>             {id:"finish", name:"Finish", field:"finish"},
>             {id:"effort-driven", name:"Effort Driven", field:"effortDriven"}
>         ];
>
>         var options = {
>             enableCellNavigation: true,
>             enableColumnReorder: false
>         };
>
>         $(function() {
>             var data = [];
>             for (var i = 0; i < 500; i++) {
>                 data[i] = {
>                     title: "Task " + i,
>                     duration: "5 days",
>                     percentComplete: Math.round(Math.random() * 100),
>                     start: "01/01/2009",
>                     finish: "01/05/2009",
>                     effortDriven: (i % 5 == 0)
>                 };
>             }
>
>             grid = new Slick.Grid("#myGrid", data, columns, options);
>
>             $("#myGrid").show();
>         })
>
>         
>
>     
>
>     
>
>          
>         
>             
>                  style="width:600px;height:500px;display:none;">
>             
>         
>         
>
>     
> 
>
> however when i run it the proper way i.e run the server "manage.py
> runserver" and enter the url i just get a blank screen ?? Does anyone know
> why this happens??

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: For loop problem in template..Is this correct

2011-08-15 Thread Konstantin Sushenko
I would just write a template tag that outputs the whole JS function.
templates are too limiting in what you can use in {{}} brackets.

konstantin

On Aug 15, 8:38 pm, Landy Chapman  wrote:
> You may be right.  I am out of my element (pardon the pun). However,
> assuming your "content" was this:
>
> content = [ { 'roll_no':1, 'cell_no': 1, 'nationality':'nation1'},
> { 'roll_no':2, 'cell_no': 2, 'nationality':'nation2'},
> { 'roll_no':3, 'cell_no': 3, 'nationality':'nation3'},
>
>  the django template renderer will turn this (note quotes around
> nationality and email):
>
> > > $(function() {
> >               i = 0;
> > >             var data = [];
> > >                 {% for x in content %}
> > >                 data[i] =
> > >                 {
> > >                     roll_no: {{x.roll_no}},
> > >                     cell_no: {{x.cell_no}},
> > >                     nationality: '{{x.nationality}}',
> > >                     e_mail: '{{x.e_mail}}'
> > >                 };
> >                     i +=1;
> > >                 {% endfor %}
>
> into this:
>  $(function() {
>                i = 0;
>              var data = [];
>
>                  data[i] =
>                  {
>                      roll_no: 1,
>                      cell_no: 1,
>                      nationality: 'nation 1',
>                      e_mail: 'email1'
>                  };
>                    i +=1;
>                  data[i] =
>                  {
>                      roll_no: 2,
>                      cell_no: 2,
>                      nationality: 'nation2',
>                      e_mail: 'email2'
>                  };
>                    i +=1;
>                  data[i] =
>                  {
>                      roll_no: 3,
>                      cell_no: 3,
>                      nationality: 'nation3',
>                      e_mail: 'email3'
>                  };
>                  i +=1;
>
> My JS guy has left for the day... maybe someone else can help out.
> Also the 'autoescaping' should be on, in case some nationality
> contains a (')  Ex: "G'ermany"
>
> HTH

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: For loop problem in template..Is this correct

2011-08-15 Thread Konstantin Sushenko
hello,

as a result of this you will have a series of 'data[i] = ...'
assignments in your output. where 'i' would be undefined.

konstantin

On Aug 15, 7:45 pm, Adam Zedan  wrote:
> Hi i am getting a problem with my for loop which i used in my template.Could
> you kindly let me know what is going wrong in here.
> The for loop is in a jquery function
>
> $(function() {
>             var data = [];
>
>                {% for x in range(len(content)) %}
>                 data[i] =
>                 {
>                     roll_no: {{content[x].roll_no}},
>                     cell_no: {{content[x].cell_no}},
>                     nationality:{{content[x].nationality}},
>                     e_mail:{{content[x].e_mail}}
>
>                 };
>                 {% endfor %}
>
>             grid = new Slick.Grid("#myGrid", data, columns, options);
>
>             $("#myGrid").show();
>         })

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Changing App/Model Names and Sort Order in index.html

2011-08-15 Thread Konstantin Sushenko
hello,

your question indicates that you have a limitedknowledge of django
templates and template tags. python code is ot supported in templates,
so your string.replace won't work.

to change the order: 
https://docs.djangoproject.com/en/dev/ref/models/querysets/#order-by

konstantin

On Aug 14, 8:27 pm, Lee  wrote:
> Is there an easy way to change "Auth" to "My Authentication App Name"
> in index.html? I tried changing {{ name }} to
> {{ string.replace(name,'Auth','My Authentication App Name') }} but it
> just kills the label completely -- hopefully just a syntax problem.
>
> How about changing the order that the models are list in on this page?
>
> Thanks for any help or ideas.

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: custom template tag. success message after form-submit in the same .html file

2011-08-15 Thread Konstantin Sushenko
hello,

you can just add a context variable 'submitted' to your context in
your view's get_context_data

konstantin

On Aug 15, 4:06 am, doniyor  wrote:
> Hi There,
>
> I am heading well now, but have still some confusing things here..
>
> this is my html file, where i want to get a success message after the
> form is submitted:
>
> __
> 
>         {% load forms %}
>         {% if submitted %}
>                 {{ success }}
>         {% else %}
>              
>         {% endif %}
>         Clear cache:  Cache leeren  a>
> 
> -
> this is my def  in templatetags folder:
> 
> success = 'Cache erfolgreich geleert'
>
> def submitted(self):
>     if request.method == 'GET':
>         return True
>
> register.tag('submitted', submitted)
> 
>
> BUT i dont see anything after submission of the form. where is my
> mistake, can you please help ?,
>
> thanks in advance..
>
> Doni

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



bug? cannot urlencode() after storing QueryDict in session

2011-08-14 Thread Konstantin Sushenko
hello,

I store request.GET in session:

request.session['query_string'] = request.GET

then I retrieve the value in another page and try to urlencode the
QueryDict:

context['query_string'] = request.session['query_string'].urlencode()

in my context I get the python's string representation of the
QueryDict object instead of the expected key0=value0&key1=value1&...
string.

If, instead of QueryDict, I store the urlencoded string in the
session, everything works of course:

request.session['query_string'] = request.GET.urlencode()

a bug?

thanks

konstantin

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.