def test_interfaces(self):
     self.browser.addHeader('Authorization', 'Basic %s:%s' % (
             TEST_USER_NAME, TEST_USER_PASSWORD, ))
     self.browser.open(self.newsfolder.absolute_url()+'/createObject?type_name=News')
     self.browser.getControl(name="title").value = "My News"
     self.browser.getControl(name="form.button.save").click()
     news = self.newsfolder.get("my-news")
     self.assertTrue(ISimpleLayoutCapable.providedBy(news))
def _simplelayout_context(self):
    context = aq_inner(self.context)

    if ISimpleLayoutCapable.providedBy(context):
        return context

    if isDefaultPage(context, self.request):
        return aq_parent(context)
    else:
        return context
Пример #3
0
 def isSimplelayout(self):
     """returns boolean if sl capable or not
     """
     context = self.context
     m_tool = getToolByName(context, 'portal_membership')
     capable = ISimpleLayoutCapable.providedBy(context)
     if m_tool.isAnonymousUser():
         return False
     member = m_tool.getAuthenticatedMember()
     # don't check modify permissions, cause edit is also in use in
     # other sircumstances
     return capable and member
Пример #4
0
    def available(self):

        conf = getUtility(ISlUtils, name='simplelayout.utils')

        context_state = getMultiAdapter((self.context, self.request),
                                        name=u'plone_context_state')
        sl_design_actions = context_state.actions().get(
            'object_simplelayout_designs', [])
        return len(sl_design_actions) > 0 and \
            conf.isDesignTabEnabled() and \
            ISimpleLayoutCapable.providedBy(self.context) and \
            conf.canMemberChangeDesign(self.context)
Пример #5
0
def reindexContainer(obj, event, parent=None):

    if not parent:
        parent = aq_parent(aq_inner(obj))

    if not ISimpleLayoutCapable.providedBy(parent):
        return

    catalog = getToolByName(obj, 'portal_catalog')
    # Only reindex existing brains! The parent may be just
    # deleted, we should not put it back in the catalog.
    parent_path = '/'.join(parent.getPhysicalPath())
    if catalog.getrid(parent_path) is not None:
        parent.reindexObject()
 def test_simplelayout_integration(self):
     contentpage = self.portal.get(self.portal.invokeFactory("ContentPage", "contentpage"))
     ISimpleLayoutCapable.providedBy(contentpage)
     IAdditionalListingEnabled.providedBy(contentpage)
    def test_simplelayout_integration(self):
        page = self.portal.get(self.portal.invokeFactory("Page", "page"))
        page.processForm()

        self.assertTrue(ISimpleLayoutCapable.providedBy(page))