def render_plugin(self, context=None, placeholder=None, admin=False, processors=None):
    (instance, plugin) = self.get_plugin_instance()
    if (instance and (not (admin and (not plugin.admin_preview)))):
        if ((not placeholder) or (not isinstance(placeholder, Placeholder))):
            placeholder = instance.placeholder
        placeholder_slot = placeholder.slot
        current_app = (context.current_app if context else None)
        context = PluginContext(context, instance, placeholder, current_app=current_app)
        context = plugin.render(context, instance, placeholder_slot)
        request = context.get('request', None)
        page = None
        if request:
            page = request.current_page
        context['allowed_child_classes'] = plugin.get_child_classes(placeholder_slot, page)
        if plugin.render_plugin:
            template = plugin._get_render_template(context, instance, placeholder)
            if (not template):
                raise ValidationError(('plugin has no render_template: %s' % plugin.__class__))
        else:
            template = None
        return render_plugin(context, instance, placeholder, template, processors, context.current_app)
    else:
        from cms.middleware.toolbar import toolbar_plugin_processor
        if (processors and (toolbar_plugin_processor in processors)):
            if (not placeholder):
                placeholder = self.placeholder
            current_app = (context.current_app if context else None)
            context = PluginContext(context, self, placeholder, current_app=current_app)
            template = None
            return render_plugin(context, self, placeholder, template, processors, context.current_app)
    return ''
def render_plugin(self, context=None, placeholder=None, admin=False, processors=None):
    (instance, plugin) = self.get_plugin_instance()
    if (instance and (not (admin and (not plugin.admin_preview)))):
        if ((not placeholder) or (not isinstance(placeholder, Placeholder))):
            placeholder = instance.placeholder
        placeholder_slot = placeholder.slot
        current_app = (context.current_app if context else None)
        context = PluginContext(context, instance, placeholder, current_app=current_app)
        context = plugin.render(context, instance, placeholder_slot)
        request = context.get('request', None)
        page = None
        if request:
            page = request.current_page
        context['allowed_child_classes'] = plugin.get_child_classes(placeholder_slot, page)
        if plugin.render_plugin:
            template = plugin._get_render_template(context, instance, placeholder)
            if (not template):
                raise ValidationError(('plugin has no render_template: %s' % plugin.__class__))
        else:
            template = None
        return render_plugin(context, instance, placeholder, template, processors, context.current_app)
    else:
        from cms.middleware.toolbar import toolbar_plugin_processor
        if (processors and (toolbar_plugin_processor in processors)):
            if (not placeholder):
                placeholder = self.placeholder
            current_app = (context.current_app if context else None)
            context = PluginContext(context, self, placeholder, current_app=current_app)
            template = None
            return render_plugin(context, self, placeholder, template, processors, context.current_app)
    return 