BenoitTalbot / bungeni-portal

Automatically exported from code.google.com/p/bungeni-portal
0 stars 0 forks source link

Browser locale is used to set default locale in bungeni #678

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Currently bungeni checks the browser locale and uses that to set the default 
language / locale in bungeni. When there is a browser language / locale for 
which there is no match in Bungeni  --the system throws up an error.. see 
traceback [1] 

To simulate this open firefox -- go to preferences -> content -> languages -> 
add language -> add 'italian ' as a language and move it up to the top of the 
prefered languages -- then browse bungeni.

The fix to this is to revert to english as the prefered language -- if a match 
to the  browser locale is not found.

[1] --- 

010-09-14 10:24:12,077 ERROR [SiteError] Exception while rendering view on 
exception
Traceback (most recent call last):
  File "/home/undesa/cinst/bungeni/eggs/zope.app.publication-3.5.3-py2.5.egg/zope/app/publication/zopepublication.py", line 333, in handleException
    body = mapply(view, (), request)
  File "/home/undesa/cinst/bungeni/eggs/zope.publisher-3.6.3-py2.5.egg/zope/publisher/publish.py", line 108, in mapply
    return debug_call(obj, args)
  File "/home/undesa/cinst/bungeni/eggs/zope.publisher-3.6.3-py2.5.egg/zope/publisher/publish.py", line 114, in debug_call
    return obj(*args)
  File "/home/undesa/cinst/bungeni/eggs/zope.app.exception-3.4.0a1-py2.5.egg/zope/app/exception/browser/notfound.py", line 28, in __call__
    return self.index(*args, **kw)
  File "/home/undesa/cinst/bungeni/eggs/z3c.pt-1.0.0-py2.5.egg/z3c/pt/pagetemplate.py", line 250, in __call__
    return self.im_func(**kw)
  File "/home/undesa/cinst/bungeni/eggs/z3c.pt-1.0.0-py2.5.egg/z3c/pt/pagetemplate.py", line 125, in render
    return self.render(**context)
  File "/home/undesa/cinst/bungeni/eggs/chameleon.core-1.0.1-py2.5.egg/chameleon/core/template.py", line 335, in render
    return super(TemplateFile, self).render(**kwargs)
  File "/home/undesa/cinst/bungeni/eggs/chameleon.zpt-1.0.0-py2.5.egg/chameleon/zpt/template.py", line 18, in render
    return super(PageTemplate, self).render(**kwargs)
  File "/home/undesa/cinst/bungeni/eggs/chameleon.core-1.0.1-py2.5.egg/chameleon/core/template.py", line 191, in render
    return self.cook_and_render(kwargs, utils.emptydict, None, True)
  File "/home/undesa/cinst/bungeni/eggs/chameleon.core-1.0.1-py2.5.egg/chameleon/core/template.py", line 315, in cook_and_render
    args, slots, macro, global_scope)
  File "/home/undesa/cinst/bungeni/eggs/chameleon.core-1.0.1-py2.5.egg/chameleon/core/template.py", line 182, in cook_and_render
    return func(econtext, rcontext)
  File "<string>", line 57, in render
  File "/home/undesa/cinst/bungeni/eggs/chameleon.core-1.0.1-py2.5.egg/chameleon/core/template.py", line 379, in render
    return self.render(name, slots=slots, parameters=kwargs)
  File "/home/undesa/cinst/bungeni/eggs/chameleon.zpt-1.0.0-py2.5.egg/chameleon/zpt/template.py", line 23, in render_macro
    macro, global_scope=global_scope, slots=slots, parameters=parameters)
  File "/home/undesa/cinst/bungeni/eggs/chameleon.core-1.0.1-py2.5.egg/chameleon/core/template.py", line 201, in render_macro
    return self.cook_and_render(parameters, slots, macro, global_scope)
  File "/home/undesa/cinst/bungeni/eggs/chameleon.core-1.0.1-py2.5.egg/chameleon/core/template.py", line 315, in cook_and_render
    args, slots, macro, global_scope)
  File "/home/undesa/cinst/bungeni/eggs/chameleon.core-1.0.1-py2.5.egg/chameleon/core/template.py", line 182, in cook_and_render
    return func(econtext, rcontext)
  File "<string>", line 523, in render
  File "/home/undesa/cinst/bungeni/src/bungeni.main/bungeni/portal/ploned.py", line 45, in render
    "", global_scope=False, slots=slots, parameters=kwargs)
  File "/home/undesa/cinst/bungeni/eggs/chameleon.html-1.0b4-py2.5.egg/chameleon/html/template.py", line 27, in render_macro
    slots=slots, parameters=parameters)
  File "/home/undesa/cinst/bungeni/eggs/chameleon.core-1.0.1-py2.5.egg/chameleon/core/template.py", line 201, in render_macro
    return self.cook_and_render(parameters, slots, macro, global_scope)
  File "/home/undesa/cinst/bungeni/eggs/chameleon.core-1.0.1-py2.5.egg/chameleon/core/template.py", line 315, in cook_and_render
    args, slots, macro, global_scope)
  File "/home/undesa/cinst/bungeni/eggs/chameleon.core-1.0.1-py2.5.egg/chameleon/core/template.py", line 182, in cook_and_render
    return func(econtext, rcontext)
  File "<string>", line 784, in render
  File "<string>", line 183, in _callback_plone_portaltop
  File "/home/undesa/cinst/bungeni/eggs/z3c.pt-1.0.0-py2.5.egg/z3c/pt/expressions.py", line 39, in __call__
    return cp.render()
  File "/home/undesa/cinst/bungeni/eggs/zope.viewlet-3.5.0-py2.5.egg/zope/viewlet/manager.py", line 169, in render
    return u'\n'.join([viewlet.render() for viewlet in self.viewlets])
  File "/home/undesa/cinst/bungeni/src/bungeni.main/bungeni/ui/z3evoque.py", line 348, in __call__
    namespace = self._get_context()
  File "/home/undesa/cinst/bungeni/src/bungeni.main/bungeni/ui/z3evoque.py", line 371, in _get_context
    i18n_domain, view.request.locale.getLocaleID())
  File "/home/undesa/cinst/bungeni/src/bungeni.main/bungeni/ui/z3evoque.py", line 179, in _get_gettext
    languages=[language])
  File "/home/undesa/cinst/python25/lib/python2.5/gettext.py", line 469, in translation
    raise IOError(ENOENT, 'No translation file found for domain', domain)
IOError: [Errno 2] No translation file found for domain: 'bungeni.ui'

Original issue reported on code.google.com by ashok.ha...@gmail.com on 14 Sep 2010 at 11:08

GoogleCodeExporter commented 8 years ago
Should be corrected in r7294.

Original comment by mario.ruggier@gmail.com on 14 Sep 2010 at 12:21

GoogleCodeExporter commented 8 years ago

Original comment by ashok.ha...@gmail.com on 23 Sep 2010 at 9:14