From b322f63a81e8bd88ec501a4d09366b0aca59307c Mon Sep 17 00:00:00 2001 From: Oskar Hahn Date: Tue, 8 Jan 2013 20:40:27 +0100 Subject: [PATCH 1/2] fixed changing language on the projector --- openslides/projector/api.py | 7 ++++--- openslides/projector/views.py | 11 ++++++----- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/openslides/projector/api.py b/openslides/projector/api.py index 7cbd5da02..a4a48ec82 100644 --- a/openslides/projector/api.py +++ b/openslides/projector/api.py @@ -89,9 +89,10 @@ def set_active_slide(sid, argument=None): def clear_projector_cache(): - cache.delete('projector_content') - cache.delete('projector_scrollcontent') - cache.delete('projector_data') + for language, __ in settings.LANGUAGES: + cache.delete('projector_content_' + language) + cache.delete('projector_scrollcontent_' + language) + cache.delete('projector_data_' + language) def register_slidemodel(model, model_name=None, control_template=None, weight=0): diff --git a/openslides/projector/views.py b/openslides/projector/views.py index 997e89cf2..35a0b6885 100644 --- a/openslides/projector/views.py +++ b/openslides/projector/views.py @@ -104,25 +104,26 @@ class Projector(TemplateView, AjaxMixin): return context def get_ajax_context(self, **kwargs): - content = cache.get('projector_content') + language = self.request.LANGUAGE_CODE + content = cache.get('projector_content_' + language) if not content: content = render_block_to_string( self.get_template_names()[0], 'content', self.data) - cache.set('projector_content', content, 1) + cache.set('projector_content_' + language, content, 1) scrollcontent = cache.get('projector_scrollcontent') if not scrollcontent: scrollcontent = render_block_to_string( self.get_template_names()[0], 'scrollcontent', self.data) - cache.set('projector_scrollcontent', scrollcontent, 1) + cache.set('projector_scrollcontent_' + language, scrollcontent, 1) # TODO: do not call the hole data-methode, if we only need some vars - data = cache.get('projector_data') + data = cache.get('projector_data_' + language) if not data: data = self.data - cache.set('projector_data', data) + cache.set('projector_data_' + language, data) # clear cache if countdown is enabled if config['countdown_state'] == 'active': clear_projector_cache() From 5dd42b85a5b07ed931399c4e19863cc7893da53c Mon Sep 17 00:00:00 2001 From: Oskar Hahn Date: Tue, 8 Jan 2013 21:42:25 +0100 Subject: [PATCH 2/2] fix pep8 errors --- openslides/assignment/views.py | 2 +- openslides/participant/views.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openslides/assignment/views.py b/openslides/assignment/views.py index f5e244732..6f95b44e0 100644 --- a/openslides/assignment/views.py +++ b/openslides/assignment/views.py @@ -318,7 +318,7 @@ class AssignmentPollDelete(DeleteView): return reverse('assignment_view', args=[self.assignment.id]) def get_success_message(self): - return _('Ballot was successfully deleted.') % self.object + return _('Ballot was successfully deleted.') % self.object class AssignmentPDF(PDFView): diff --git a/openslides/participant/views.py b/openslides/participant/views.py index 34cb032a0..32de514e3 100644 --- a/openslides/participant/views.py +++ b/openslides/participant/views.py @@ -478,7 +478,7 @@ def login(request): extra_content = {} try: admin = User.objects.get(pk=1) - if admin.check_password(admin.default_password): + if admin.check_password(admin.default_password): extra_content['first_time_message'] = _( "Installation was successfully! Use %(user)s " "(password: %(password)s) for first login.
"