Ejemplo n.º 1
0
 def get_block_content(self):
     # It's possible, that we're cropping an image within a block instead an
     # image of a block. In this case, we're not able to return the sl-block
     # html. To fix this issue, we're looking up the next sl-block.
     #
     # This case happens i.e. while cropping a slider pane within the sliderblock.
     return get_block_html(self._sl_block())
Ejemplo n.º 2
0
    def _render_block_html(self, block):

        try:
            html = get_block_html(block)
        except ConflictError:
            raise
        except Exception, exc:
            LOG.exception(exc)
            html = self.fallbackview()
Ejemplo n.º 3
0
    def _render_block_html(self, block):

        try:
            html = get_block_html(block)
        except ConflictError:
            raise
        except Exception, exc:
            html = self.fallbackview()
            LOG.error('Could not render block: {}: {}'.format(
                exc.__class__.__name__,
                str(exc)))
Ejemplo n.º 4
0
    def test_get_html_block_with_unicode_viewname(self, browser):
        page = create(Builder('sl content page'))
        block = create(Builder('sl textblock')
                       .within(page)
                       .titled(u'My Text Block'))

        # Set a unicode view name.
        annotations = IAnnotations(block)
        if BLOCK_PROPERTIES_KEY not in annotations:
            annotations[BLOCK_PROPERTIES_KEY] = PersistentMapping({
                'view-name': u'block_view'
            })

        self.assertIn(u'My Text Block', get_block_html(block))
Ejemplo n.º 5
0
 def get_block_content(self):
     block = self.context.aq_parent
     if ISimplelayoutBlock.providedBy(block):
         return get_block_html(block)
     else:
         raise ValueError("The parent needs to be a simplelayout block")
Ejemplo n.º 6
0
 def get_block_content(self):
     return get_block_html(self.context)
Ejemplo n.º 7
0
 def createAndAdd(self, data):
     obj = super(AddForm, self).createAndAdd(data)
     self.obj_uid = obj.UID()
     aq_obj = obj.__of__(self.context)
     self.obj_html = get_block_html(aq_obj)
     return obj