def testLanguageIndependentField(self):
        english = makeContent(self.folder, 'SimpleType', 'doc')
        english.setLanguage('en')

        contact = 'Fred Flintstone'
        english.setContactName(contact)
        german = makeTranslation(english, 'de')
        self.assertEqual(english.getContactName(), contact)
        self.assertEqual(english.getRawContactName(), contact)
        self.assertEqual(german.getContactName(), contact)
        self.assertEqual(german.getRawContactName(), contact)
        self.failUnless(english.contactName)
        self.failUnless(german.contactName)
        # self.failUnless(hasattr(german, 'testing'))
        # self.assertEqual(german.testing, english.contactName)
        self.assertEqual(english.contactName, german.contactName)

        contact = 'Barney Rubble'
        german.setContactName(contact)
        notify(ObjectEditedEvent(german))
        self.assertEqual(english.getContactName(), contact)
        self.assertEqual(english.getRawContactName(), contact)
        self.assertEqual(german.getContactName(), contact)
        self.assertEqual(german.getRawContactName(), contact)
        self.failUnless(english.contactName)
        self.failUnless(german.contactName)
        # self.failUnless(hasattr(english, 'testing'))
        # self.assertEqual(english.testing, german.contactName)
        self.assertEqual(english.contactName, german.contactName)

        # Sanity check: not all fields are language independent
        english.setTitle('English title')
        german.setTitle('German title')
        self.failIfEqual(english.Title(), german.Title())
    def testLanguageIndependentField(self):
        english = makeContent(self.folder, 'SimpleType', 'doc')
        english.setLanguage('en')

        contact = 'Fred Flintstone'
        english.setContactName(contact)
        german = makeTranslation(english, 'de')
        self.assertEqual(english.getContactName(), contact)
        self.assertEqual(english.getRawContactName(), contact)
        self.assertEqual(german.getContactName(), contact)
        self.assertEqual(german.getRawContactName(), contact)
        self.failUnless(english.contactName)
        self.failUnless(german.contactName)
        # self.failUnless(hasattr(german, 'testing'))
        # self.assertEqual(german.testing, english.contactName)
        self.assertEqual(english.contactName, german.contactName)

        contact = 'Barney Rubble'
        german.setContactName(contact)
        notify(ObjectEditedEvent(german))
        self.assertEqual(english.getContactName(), contact)
        self.assertEqual(english.getRawContactName(), contact)
        self.assertEqual(german.getContactName(), contact)
        self.assertEqual(german.getRawContactName(), contact)
        self.failUnless(english.contactName)
        self.failUnless(german.contactName)
        # self.failUnless(hasattr(english, 'testing'))
        # self.assertEqual(english.testing, german.contactName)
        self.assertEqual(english.contactName, german.contactName)

        # Sanity check: not all fields are language independent
        english.setTitle('English title')
        german.setTitle('German title')
        self.failIfEqual(english.Title(), german.Title())
Exemplo n.º 3
0
    def test_monkey_folderish(self):
        self.browser.addHeader('Authorization', auth_header)

        folder = makeContent(self.portal, 'Folder', id='folder')
        ILanguage(folder).set_language('ca')
        transaction.commit()

        self.browser.open('{0:s}/createObject?type_name=Document'.format(
            folder.absolute_url()))
        self.browser.getControl(name="title").value = "subfolder"
        self.browser.getControl(name="form.button.save").click()

        self.assertEqual(ILanguage(folder['subfolder']).get_language(), 'ca')
Exemplo n.º 4
0
    def test_monkey_folderish(self):
        self.browser.addHeader('Authorization', 'Basic %s:%s' % (TEST_USER_NAME, TEST_USER_PASSWORD))
        setRoles(self.portal, TEST_USER_ID, ['Manager'])
        login(self.portal, TEST_USER_NAME)
        folder = makeContent(self.portal, 'Folder', id='folder')
        ILanguage(folder).set_language('ca')
        transaction.commit()

        self.browser.open(folder.absolute_url() + '/createObject?type_name=Folder')
        self.browser.getControl(name="title").value = "subfolder"
        self.browser.getControl(name="form.button.save").click()

        self.assertEqual(ILanguage(folder['subfolder']).get_language(), 'ca')
Exemplo n.º 5
0
    def test_monkey_folderish(self):
        self.browser.addHeader('Authorization', auth_header)

        folder = makeContent(self.portal, 'Folder', id='folder')
        ILanguage(folder).set_language('ca')
        transaction.commit()

        self.browser.open('{0:s}/createObject?type_name=Document'.format(
            folder.absolute_url()))
        self.browser.getControl(name="title").value = "subfolder"
        self.browser.getControl(name="form.button.save").click()

        self.assertEqual(ILanguage(folder['subfolder']).get_language(), 'ca')