Git Product home page Git Product logo

Comments (8)

mbi avatar mbi commented on May 17, 2024

Okay, do you know which file has that problem? Do you have a complete stacktrace? If so, could you please paste it here?

Also, Rosetta 0.7.1 was released, could you please try to upgrade and see if the problem disappears?

from django-rosetta.

mbrochh avatar mbrochh commented on May 17, 2024

Ok I just updated to 0.7.1

One other thing I noticed: Clicking the paginators kind of worked now but after about 4 clicks I would end up on the home page again. After just clicking "Save and translate next block" for 4 or 5 times, I finally got this error again:

Environment:


Request Method: POST
Request URL: http://localhost:8000/rosetta/?page=6

Django Version: 1.4.3
Python Version: 2.7.3
Installed Applications:
['buildee',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.admin',
 'django.contrib.admindocs',
 'django.contrib.sitemaps',
 'multilingual_project_blog',
 'django_extensions',
 'django_libs',
 'south',
 'rosetta',
 'document_library',
 'hero_slider',
 'multilingual_events',
 'people',
 'roadmap',
 'cms',
 'sekizai',
 'mptt',
 'menus',
 'cms.plugins.text',
 'cms.plugins.link',
 'cms.plugins.snippet',
 'cms.plugins.googlemap',
 'cmsplugin_link_extended',
 'cmsplugin_blog',
 'djangocms_utils',
 'simple_translation',
 'tagging',
 'missing',
 'cmsplugin_blog_categories',
 'cmsplugin_blog_images',
 'cmsplugin_blog_authors',
 'tagging_translated',
 'filer',
 'cmsplugin_filer_file',
 'cmsplugin_filer_image',
 'cmsplugin_filer_folder',
 'easy_thumbnails',
 'cmsplugin_filer_image_translated',
 'debug_toolbar']
Installed Middleware:
['johnny.middleware.LocalStoreClearMiddleware',
 'johnny.middleware.QueryCacheMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'multilingual_project_blog.middleware.SwitchLanguageMiddleware',
 'multilingual_project_blog.middleware.CanonicalURLMiddleware',
 'cms.middleware.multilingual.MultilingualURLMiddleware',
 'cms.middleware.page.CurrentPageMiddleware',
 'cms.middleware.user.CurrentUserMiddleware',
 'cms.middleware.toolbar.ToolbarMiddleware',
 'simple_translation.middleware.MultilingualGenericsMiddleware',
 'cmsplugin_blog.middleware.MultilingualBlogEntriesMiddleware',
 'debug_toolbar.middleware.DebugToolbarMiddleware']


Traceback:
File "/Users/martin/Envs/buildee/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  117.                             response = middleware_method(request, e)
File "/Users/martin/Envs/buildee/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  111.                         response = callback(request, *callback_args, **callback_kwargs)
File "/Users/martin/Envs/buildee/lib/python2.7/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
  89.         response = view_func(request, *args, **kwargs)
File "/Users/martin/Envs/buildee/lib/python2.7/site-packages/django/contrib/auth/decorators.py" in _wrapped_view
  20.                 return view_func(request, *args, **kwargs)
File "/Users/martin/Envs/buildee/lib/python2.7/site-packages/rosetta/views.py" in home
  57.         rosetta_i18n_lang_bidi = rosetta_i18n_lang_code.split('-')[0] in settings.LANGUAGES_BIDI

Exception Type: AttributeError at /rosetta/
Exception Value: 'NoneType' object has no attribute 'split'

Once the error appeared, it stays there.

I restarted apache and tried again. This time it took 25 clicks before it happened.

So I put a try except block around the line (57) and put a breakpoint into the except block. Then I restarted the apache server and clicked until the error happend. But this time it was a different error:

'NoneType' object has no attribute 'replace'
In template /Users/martin/Envs/buildee/lib/python2.7/site-packages/rosetta/templates/rosetta/pofile.html, error at line 18
{% block pagetitle %}{{block.super}} - {{rosetta_settings.MESSAGES_SOURCE_LANGUAGE_NAME}} - {{rosetta_i18n_lang_name}} ({{ rosetta_i18n_pofile.percent_translated|floatformat:0 }}%){% endblock %}

Traceback:
File "/Users/martin/Envs/buildee/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  117.                             response = middleware_method(request, e)
File "/Users/martin/Envs/buildee/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  111.                         response = callback(request, *callback_args, **callback_kwargs)
File "/Users/martin/Envs/buildee/lib/python2.7/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
  89.         response = view_func(request, *args, **kwargs)
File "/Users/martin/Envs/buildee/lib/python2.7/site-packages/django/contrib/auth/decorators.py" in _wrapped_view
  20.                 return view_func(request, *args, **kwargs)
File "/Users/martin/Envs/buildee/lib/python2.7/site-packages/rosetta/views.py" in home
  268.         ), context_instance=RequestContext(request))
File "/Users/martin/Envs/buildee/lib/python2.7/site-packages/django/shortcuts/__init__.py" in render_to_response
  20.     return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)
File "/Users/martin/Envs/buildee/lib/python2.7/site-packages/django/template/loader.py" in render_to_string
  176.         return t.render(context_instance)
File "/Users/martin/Envs/buildee/lib/python2.7/site-packages/django/template/base.py" in render
  140.             return self._render(context)
File "/Users/martin/Envs/buildee/lib/python2.7/site-packages/django/test/utils.py" in instrumented_test_render
  62.     return self.nodelist.render(context)
File "/Users/martin/Envs/buildee/lib/python2.7/site-packages/django/template/base.py" in render
  823.                 bit = self.render_node(node, context)
File "/Users/martin/Envs/buildee/lib/python2.7/site-packages/django/template/debug.py" in render_node
  74.             return node.render(context)
File "/Users/martin/Envs/buildee/lib/python2.7/site-packages/django/template/loader_tags.py" in render
  123.         return compiled_parent._render(context)
File "/Users/martin/Envs/buildee/lib/python2.7/site-packages/django/test/utils.py" in instrumented_test_render
  62.     return self.nodelist.render(context)
File "/Users/martin/Envs/buildee/lib/python2.7/site-packages/django/template/base.py" in render
  823.                 bit = self.render_node(node, context)
File "/Users/martin/Envs/buildee/lib/python2.7/site-packages/django/template/debug.py" in render_node
  74.             return node.render(context)
File "/Users/martin/Envs/buildee/lib/python2.7/site-packages/django/template/loader_tags.py" in render
  62.             result = block.nodelist.render(context)
File "/Users/martin/Envs/buildee/lib/python2.7/site-packages/django/template/base.py" in render
  823.                 bit = self.render_node(node, context)
File "/Users/martin/Envs/buildee/lib/python2.7/site-packages/django/template/debug.py" in render_node
  74.             return node.render(context)
File "/Users/martin/Envs/buildee/lib/python2.7/site-packages/django/template/debug.py" in render
  87.             output = force_unicode(output)
File "/Users/martin/Envs/buildee/lib/python2.7/site-packages/django/utils/encoding.py" in force_unicode
  71.                 s = unicode(s)
File "/Users/martin/Envs/buildee/lib/python2.7/site-packages/django/utils/functional.py" in __unicode_cast
  121.             return func(*self.__args, **self.__kw)
File "/Users/martin/Envs/buildee/lib/python2.7/site-packages/django/utils/translation/__init__.py" in ugettext
  86.     return _trans.ugettext(message)
File "/Users/martin/Envs/buildee/lib/python2.7/site-packages/django/utils/translation/trans_real.py" in ugettext
  278.     return do_translate(message, 'ugettext')
File "/Users/martin/Envs/buildee/lib/python2.7/site-packages/django/utils/translation/trans_real.py" in do_translate
  261.     eol_message = message.replace('\r\n', '\n').replace('\r', '\n')

This is really weird, at this code rosetta doesn't seem to be involved.

I tried again, this time the breakpoint was hit.

settings.LANGUAGES_BIDI is ('he', 'ar', 'fa')
rosetta_i18n_lang_code is None

I have no idea what these three languages are... my site uses 'en' and 'zh'.

from django-rosetta.

mbrochh avatar mbrochh commented on May 17, 2024

From further digging it seems that his has to do something with the cache storage value getting lost. I also found the note about Storages and DJango 1.4 in the README... I will try if setting ROSETTA_STORAGE_CLASS = 'rosetta.storage.CacheRosettaStorage' gets me somewhere...

from django-rosetta.

mbi avatar mbi commented on May 17, 2024

Thanks for the feedback. Yes, please try either the Cache or the Session storage.

Also, what is the value of CACHES in your settings?

from django-rosetta.

mbrochh avatar mbrochh commented on May 17, 2024

@mbi I don't think I have any, what should it be?

from django-rosetta.

mbi avatar mbi commented on May 17, 2024

Yes, that's most likely the problem: if you use the CacheBackend you should use a proper cache backend, e.g. Redis or Memcached.

By default Django uses the LocMemem cache backend, which is tied to each server process (and is cycled when the server process is recycled).

Which would explain why everything works for a while and then suddenly breaks.

from django-rosetta.

mbrochh avatar mbrochh commented on May 17, 2024

Yea I just changed it to database backend and now it is significantly slower but seems to work. Thanks a lot!

from django-rosetta.

mbi avatar mbi commented on May 17, 2024

Cheers! (You should install memcached if you get a chance)

from django-rosetta.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.