def test_strip_proxy_returns_proxy_view_without_postfix(self):
        view = self.dossier.restrictedTraverse('tabbedview_view-documents-proxy')

        self.assertTrue(ITabbedViewProxy.providedBy(view))
        self.assertEqual(
            'tabbedview_view-documents',
            IDictStorage(view).strip_proxy_postfix(view, view.__name__))
    def test_strip_proxy_postfix_will_replace_only_if_ITabbedViewProxy_is_provided(self):
        view = self.dossier.restrictedTraverse('tabbedview_view-documents')
        value = 'documents_view-documents-proxy'

        self.assertFalse(ITabbedViewProxy.providedBy(view))
        self.assertEqual(
            'documents_view-documents-proxy',
            IDictStorage(view).strip_proxy_postfix(view, value))
    def test_get_key_returns_proxy_view_without_postfix_on_dossier(self):
        view = self.dossier.restrictedTraverse("tabbedview_view-documents-proxy")

        self.assertTrue(ITabbedViewProxy.providedBy(view))

        generator = getMultiAdapter((self.dossier, view, self.request), IGridStateStorageKeyGenerator)

        self.assertEqual("ftw.tabbedview-openever.dossier-tabbedview_view-documents-test_user_1_", generator.get_key())
Esempio n. 4
0
    def test_get_key_returns_proxy_view_without_postfix(self):
        view = self.portal.restrictedTraverse(
            'tabbedview_view-mydocuments-proxy')

        self.assertTrue(ITabbedViewProxy.providedBy(view))

        generator = getMultiAdapter((self.portal, view, self.request),
                                    IGridStateStorageKeyGenerator)

        self.assertEqual(
            'ftw.tabbedview-Plone Site-tabbedview_view-mydocuments-test_user_1_',
            generator.get_key())
Esempio n. 5
0
    def get_key(self):
        key = []
        key.append('ftw.tabbedview')

        # replace the portal type with static 'opengever.dossier'
        key.append('openever.dossier')

        # add the name of the tab
        view_name = self.tabview.__name__

        if ITabbedViewProxy.providedBy(self.tabview):
            view_name = self.tabview.name_without_postfix
        key.append(view_name)

        # add the userid
        mtool = getToolByName(self.context, 'portal_membership')
        member = mtool.getAuthenticatedMember()
        key.append(member.getId())

        # concatenate with "-"
        return '-'.join(key)
    def change_proxy_context(self, view):
        if ITabbedViewProxy.providedBy(view):
            non_proxy_view_name = self.strip_proxy_postfix(view, view.__name__)
            view = view.context.restrictedTraverse(non_proxy_view_name)

        return view
 def strip_proxy_postfix(self, view, value):
     if ITabbedViewProxy.providedBy(view):
         value = view.name_without_postfix
     return value
Esempio n. 8
0
    def change_proxy_context(self, view):
        if ITabbedViewProxy.providedBy(view):
            non_proxy_view_name = self.strip_proxy_postfix(view, view.__name__)
            view = view.context.restrictedTraverse(non_proxy_view_name)

        return view
Esempio n. 9
0
 def strip_proxy_postfix(self, view, value):
     if ITabbedViewProxy.providedBy(view):
         value = view.name_without_postfix
     return value
Esempio n. 10
0
 def _append_view_name(self, key):
     view_name = self.tabview.__name__
     if ITabbedViewProxy.providedBy(self.tabview):
         view_name = self.tabview.name_without_postfix
     key.append(view_name)