コード例 #1
0
 def test_set_active_bundle_name(self):
     # Verifies that get_localized and get_rendered are properly affected
     # by set_active_bundle_name.
     self.put_resource('1', 'xyz', 0, 'one')
     self.put_resource('2', 'xyz', 0, 'two')
     assert resources.get_localized('xyz', 'en').content == 'one'
     assert resources.get_rendered('xyz', 'en') == 'one'
     resources.set_active_bundle_name('2')
     assert resources.get_localized('xyz', 'en').content == 'two'
     assert resources.get_rendered('xyz', 'en') == 'two'
     resources.set_active_bundle_name('1')
     assert resources.get_localized('xyz', 'en').content == 'one'
     assert resources.get_rendered('xyz', 'en') == 'one'
コード例 #2
0
ファイル: test_resources.py プロジェクト: google/personfinder
 def test_set_active_bundle_name(self):
     # Verifies that get_localized and get_rendered are properly affected
     # by set_active_bundle_name.
     self.put_resource('1', 'xyz', 0, 'one')
     self.put_resource('2', 'xyz', 0, 'two')
     assert resources.get_localized('xyz', 'en').content == 'one'
     assert resources.get_rendered('xyz', 'en') == 'one'
     resources.set_active_bundle_name('2')
     assert resources.get_localized('xyz', 'en').content == 'two'
     assert resources.get_rendered('xyz', 'en') == 'two'
     resources.set_active_bundle_name('1')
     assert resources.get_localized('xyz', 'en').content == 'one'
     assert resources.get_rendered('xyz', 'en') == 'one'
コード例 #3
0
 def test_set_active_bundle_name(self):
     # Verifies that get_localized and get_rendered are properly affected
     # by set_active_bundle_name.
     self.put_resource("1", "xyz", 0, "one")
     self.put_resource("2", "xyz", 0, "two")
     assert resources.get_localized("xyz", "en").content == "one"
     assert resources.get_rendered("xyz", "en") == "one"
     resources.set_active_bundle_name("2")
     assert resources.get_localized("xyz", "en").content == "two"
     assert resources.get_rendered("xyz", "en") == "two"
     resources.set_active_bundle_name("1")
     assert resources.get_localized("xyz", "en").content == "one"
     assert resources.get_rendered("xyz", "en") == "one"
コード例 #4
0
 def load_template(self, name, dirs):
     import resources
     lang = django.utils.translation.get_language()  # currently active lang
     resource = resources.get_localized(name, lang)
     template = resource and resource.get_template()
     if template:
         return template, name + ':' + lang
     else:
         raise django.template.TemplateDoesNotExist(name)
コード例 #5
0
 def get_template(self, name, template_dirs=None, skip=None):
     import resources
     lang = django.utils.translation.get_language()  # currently active lang
     resource = resources.get_localized(name, lang)
     template = resource and resource.get_template()
     if template:
         return template
     else:
         raise django.template.TemplateDoesNotExist(name)
コード例 #6
0
ファイル: django_setup.py プロジェクト: tqangxl/personfinder
 def load_template(self, name, dirs):
     import resources
     lang = django.utils.translation.get_language()  # currently active lang
     resource = resources.get_localized(name, lang)
     template = resource and resource.get_template()
     if template:
         return template, name + ':' + lang
     else:
         raise django.template.TemplateDoesNotExist(name)