Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4005454
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T08:23:44+00:00 2026-05-20T08:23:44+00:00

I upgraded to django 1.2 and I now get this error message which looks

  • 0

I upgraded to django 1.2 and I now get this error message which looks related to i18n. Can you tell what I should do? thanks

global name '_' is not defined
Traceback (most recent call last):
  File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/webapp/__init__.py", line 515, in __call__
    handler.get(*groups)
  File "/base/data/home/apps/classifiedsmarket/blobstore.348713784647505124/i18n.py", line 252, in get
    loginmsg = loginmsg + '<a href=\"%s\">%s</a>' % ('login',_("Log in"))
NameError: global name '_' is not defined

UPDATE after having added the new import statement the code looks like

   # let user choose authenticator        
        for p in openIdProviders:
            p_name = p.split('.')[0] # take "AOL" from "AOL.com"
            p_url = p.lower()        # "AOL.com" -> "aol.com"
            loginmsg = loginmsg + '<a href="%s">%s</a> ' % ( #'','')
             #      users.create_login_url(federated_identity=p_url), p_name)
                    'google.com', p_name)
        loginmsg = loginmsg + '<a href=\"%s\">%s</a>' % ('login',_("Log in"))

and in template

    <ul><li><a href="ai">{% trans "Add" %}</a></li>
    <li><a href="li">{{ latest.modified|date:"d M" }}</a></li>                  
<li>{% if user %}<a href="{{ user_url|fix_ampersands }}">{% trans "Log out" %}</a>
{% else %}{% trans "Log in" %}{{loginmsg}}{% endif %}</li>
</ul>

leading the junk on the view like the image here where the expected output is links and buttons. Could you inform a bit more? Thanks

enter image description here

Now inspected the HTML it appears that it’s something with the escpae coding. COuld you tell?

<ul><li><a href="ai">Add</a></li><li><a href="li">03 Mar</a></li>                   

<li>Log in&lt;a href=&quot;google.com&quot;&gt;Google&lt;/a&gt; &lt;a href=&quot;google.com&quot;&gt;Yahoo&lt;/a&gt; &lt;a href=&quot;google.com&quot;&gt;MySpace&lt;/a&gt; &lt;a href=&quot;google.com&quot;&gt;AOL&lt;/a&gt; &lt;a href=&quot;login&quot;&gt;Log in&lt;/a&gt;</li>

</ul>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T08:23:45+00:00Added an answer on May 20, 2026 at 8:23 am

    Found this at Old Django 1.0 manual (App Engine’s default version is 0.98 I think).

    Here’s the answer:

    STANDARD TRANSLATION:

    Python’s standard library gettext module installs _() into the global namespace, as an alias for gettext(). In Django, we have chosen not to follow this practice, for a couple of reasons:

    For international character set (Unicode) support, ugettext() is more useful than gettext(). Sometimes, you should be using ugettext_lazy() as the default translation method for a particular file. Without _() in the global namespace, the developer has to think about which is the most appropriate translation function.

    The underscore character (_) is used to represent “the previous result” in Python’s interactive shell and doctest tests. Installing a global _() function causes interference. Explicitly importing ugettext() as _() avoids this problem.

    That’s why the old one works, meanwhile in Django 1.2 you need to specify:

    from django.utils.translation import gettext_lazy as _
    

    as Niklas R suggested.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

EDIT: Issue solved, answered it below. Lame error. Blah So I upgraded to Django
I upgraded to XCode 3.2.3 recently, and now, I see i can't set a
I have upgraded my php now i am getting warning messages for eregi_replace Can
I upgraded a Rails application from 2.1.0 to 2.2.2 using rake rails:update . This
I recently upgraded a VS2005 web deployment project to VS2008 - and now I
I recently upgraded to Subversion 1.5, and now I cannot commit my code to
I learned how to authenticate users in Django months ago, but I've since upgraded
Not a Django developer. We initially installed Django from Ubuntu packages by typing apt-get
I have just upgraded to Django 1.2 and I am trying to run my
EDIT: upgraded this question to MVC 2.0 With asp.net MVC 2.0 is there an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.