Re: Users getting logged out/cookie issues?

2008-05-30 Thread Jack M.

I'm fairly new to django, and I don't know it's intricacies very well,
but common sense says:

1.  Are they changing domains?  Maybe logging in on mydomain.com and
being redirected to www.mydomain.com ?

2.  Are they hopping IP addresses in the middle of their session?
Common for larger corporations with big honking proxies to the outside
world.

3.  Failing that, can you paste the information out of the cookie, as
it may provide more information?

On May 30, 6:47 am, Jarek Zgoda <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] pisze:
>
>
>
> > I've got multiple users all saying roughly the same thing as this
> > one:
> > "I come to the site and log in.  I click on to a page and I'm logged
> > out. I try to log back in and it says my cookies are disabled. Log in
> > - log in - I'm in, and then I click on a page and I'm out again. Over
> > and over Says I'm in, then I'm out again
>
> > Clear all the cookies and delete temporary internet files and I'm
> > good...for a couple hours and then the whole thing starts again."
>
> > It's turned up mostly with IE6, but I've seen reports from people on
> > Mozilla-based browsers, too.
>
> > Caching is turned on using memcached, with
> > CACHE_MIDDLEWARE_ANONYMOUS_ONLY set to True
> > I do have two sites running and thought maybe there was an issue with
> > the cookies or sessions conflicting, so I have at least one of the
> > sites setting a SESSION_COOKIE_DOMAIN.
>
> I'm getting the same on my sites, mostly with IE6, but sometimes happens
> with IE7. I'm using 0.96.
>
> --
> Jarek Zgoda
> Skype: jzgoda | GTalk: [EMAIL PROTECTED] | voice: +48228430101
>
> "We read Knuth so you don't have to." (Tim Peters)
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: i18n issues.

2008-05-30 Thread Jack M.

Holy crap I'm an idiot.
Thanks, Ramiro, you hit the nail on the head.  I've been using sp for
spanish for so long I completely spaced that it is incorrect usage.
Once I switched to es everything worked.

Another one chalked up to PEBKAC.

Thanks,
-Jack


On May 29, 3:54 pm, "Ramiro Morales" <[EMAIL PROTECTED]> wrote:
> Jack,
>
> On Thu, May 29, 2008 at 2:51 PM, Jack M. <[EMAIL PROTECTED]> wrote:
>
> > [...]
>
> >  Used make-message.py -l sp to generate the Spanish language files.
>
> Why are you using "sp" for Spanish?. You should be using "es" as that's the
> two-letter code for the spanish language used both by the gettext
> infrastructure and the browser language preferences.
>
> If you insist on using a new "sp" custom language code you will need to make
> sure:
>
> a) you (and your users') browsers sends "sp" in the list of languages
>preference represented by the Accept-Language HTTP request header.
>
> b) you create a minimal translation of Django to "sp" (in addition to the
>translation of your app), as per the "Locale restrictions" note here:
>
>  http://www.djangoproject.com/documentation/i18n/#how-to-create-langua...
>
>and here:
>
>  http://www.djangobook.com/en/1.0/chapter18/
>
>(starting on the paragraph that begins with: "The LocaleMiddleware can only
> select languages for which there is a Django-provided base translation.")
>
> But even if you do that, I'm not sure you will get because the GNU gettext
> machinery Django uses might simply refuse to handle a language that doesn't
> exist (from what I can see "sp" isn't a two-lteer code known by gettext), so I
> can't imagine why would you want to embark yourself in such a task.
>
> Regards,
>
> --
>  Ramiro Morales
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



i18n issues.

2008-05-29 Thread Jack M.

Hello, all.  Forgive me as I'm still fairly new to django, but I'm
having some issues getting i18n running, and I can't seem to find any
help in the online docs.

I've read chapter 18 (i18n) of djangobook.com, and chapter 10 relating
to RequestContext.  I've also read the docs on djangoproject.com for
the same subjects.

Basic problem description:  No matter what language I select, I get
English output.

My setup:
  OSX.5.3
  manually compiled gettext from source because xgettext was missing
from OSX.
  django from svn revision 7565 (did an update this morning).
  brand new project just for testing this functionality.
  mysql database (ran manage.py syncdb after getting the middle ware
setup).

What I've written:
  url r'^i18n/$' mapped to:  include('django.conf.urls.i18n') per
djangobook.com and djangoproject.com
  url r'^lang/' mapped to dolang from my views, which displays the
example code from djangobook.com on how to switch languages.  Changed
method="get" to POST so that it'll actually work.
  url r'^$' to hello_world from my views, which displays a template
say_hello.html with a simple string as output and a link to /lang/.

Hurtles I've already crossed:
  Made sure to use RequestContext in every (or both, whatever :)
request.
  Used make-message.py -l sp to generate the Spanish language files.
  Translated the two tokens (views.py:10, and templates/say_hello.html:
7) in the locale/sp/LC_MESSAGES_django.po file.
  Used compile-messages.py to compile the language into the django.mo
file.
  Ensured that the cookie is being set in my browser for the session,
and that the language is being saved to the session.
  Ensured that the language is in fact being saved to
request.LANGUAGE_CODE.
  Tried simply printing the string and bypassing the templates all
together.  Always outputs English.
  Pounded head into wall multiple times.

Any help is greatly appreciated.  I'm really excited about pitching
django to upper management and ridding myself of the perl hell I've
been tossed into.  ^_^

Below is the code, I'll leave out obvious things like import
statements.

-- views.py --
def dolang(request):
return render_to_response('dolang.html', {},
context_instance=RequestContext(request))

def hello_world(request):
string = _("Hello %(lang)s world!") % {'lang':
request.LANGUAGE_CODE}
print request.session['django_language']
print string
return render_to_response('say_hello.html', {'string': string},
context_instance=RequestContext(request))
-- / views.py --

-- urls.py --
urlpatterns = patterns('',
(r'^i18n/', include('django.conf.urls.i18n')),
(r'^lang/', dolang),
(r'^$', hello_world),
)
-- / urls.py --

-- templates/say_hello.html --
{% load i18n %}



{{ string }}

{% trans "Choose a language" %}


-- / templates/say_hello.html --
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---