473,385 Members | 1,893 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

AttributeError: 'RequestWithUserAttribute' object has no attribute 'translate'

I have this configuration:

suscribers.py
Expand|Select|Wrap|Line Numbers
  1. from pyramid.i18n import get_localizer, TranslationStringFactory
  2.  
  3. def add_renderer_globals(event):
  4.     request = event.get('request')
  5.     if request is None: request = get_current_request()
  6.     event['_'] = request.translate
  7.     event['localizer'] = request.localizer
  8.  
  9. tsf = TranslationStringFactory('smd')
  10.  
  11. def add_localizer(event):
  12.     request = event.request
  13.     localizer = get_localizer(request)
  14.     def auto_translate(string):
  15.         return localizer.translate(tsf(string))
  16.     request.localizer = localizer
  17.     request.translate = auto_translate
but when i acces to the view, have the AttributeError: 'RequestWithUserAttribute' object has no attribute 'translate'
Nov 4 '11 #1
1 2779
bvdet
2,851 Expert Mod 2GB
It appears that either request or localizer is a RequestWithUserAttribute object and has no attribute translate. Did you try posting your problem to the Pylons-devel mailing list or #pylons channel on FreeNode?
Nov 4 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: dont bother | last post by:
Hey, I am trying to run the following example from diveintopython import urllib sock = urllib.urlopen("http://diveintopython.org/") htmlSource = sock.read() sock.close() print htmlSource
4
by: adrian | last post by:
I get those errors when I run: /usr/local/bin/SquidClamAV_Redirector.py -c /etc/squid/SquidClamAV_Redirector.conf ################## Traceback (most recent call last): File...
2
by: rsd | last post by:
Hi, I'm trying get Samsung YH-920 mp3 player to work with Debian GNU/Linux. To do that I need to run http://www.paul.sladen.org/toys/samsung-yh-925/yh-925-db-0.1.py script, the idea behind the...
0
by: kepioo | last post by:
I am running a script (summary.py) which is calling the method logException in another module ( pytool). Yesterday, ard 18:50, all of a sudden summary.py was throwing the exception : ...
7
by: erikcw | last post by:
Hi, I'm trying to build a SQL string sql = """INSERT INTO ag ('cid', 'ag', 'test') VALUES(%i, %s, %d)""", (cid, ag, self.data) It raises this error: AttributeError: 'tuple' object has no...
0
by: rkmr.em | last post by:
Hi I built and installed python 2.5 from source and when I do this: opener = urllib2.build_opener(SmartRedirectHandler(), DefaultErrorHandler(), urllib2.HTTPSHandler()) I get this error....
0
by: Matt McCredie | last post by:
I built and installed python 2.5 from source and when I do this: You need `_ssl.pyd' for HTTPSHandler to work. I guess, try to figure out why that wasn't built, then build it. I suppose I...
4
by: black_13 | last post by:
what does this error mean? i am trying to use mark hammonds win32 package. Traceback (most recent call last): File "aui2.py", line 11, in <module> import win32com.client File...
4
by: Nikhil | last post by:
I have recently written a small module. When I import the module, I always get the error only when I do -- Traceback (most recent call last): File "<stdin>", line 1, in <module>
1
by: =?iso-8859-1?q?KLEIN_St=E9phane?= | last post by:
Hi, I'm on Ubuntu 8.04.1 I've installed lxml with easy_install lxml command. Now, when I load etree I've this error : $ python Python 2.5.2 (r252:60911, Apr 21 2008, 11:12:42)
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.