<commit_before>from cms.plugin_pool import plugin_pool
from cms.plugin_base import CMSPluginBase
from django.utils.translation import ugettext_lazy as _
import models
from django.conf import settings


class FilerTeaserPlugin(CMSPluginBase):
    """
    TODO: this plugin is becoming very similar to the image plugin... code 
          should be re-used somehow.
    """
    model = models.FilerTeaser
    name = _("Teaser")
    render_template = "cmsplugin_filer_teaser/teaser.html"
    
    def _get_thumbnail_options(self, context, instance):
        """
        Return the size and options of the thumbnail that should be inserted
        """
        width, height = None, None
        subject_location = False
        placeholder_width = context.get('width', None)
        if instance.use_autoscale and placeholder_width:
            # use the placeholder width as a hint for sizing
            width = int(placeholder_width)
        elif instance.width:
            width = instance.width
        if instance.height:
            height = instance.height<commit_msg>pick up height variable from context<commit_after>from cms.plugin_pool import plugin_pool
from cms.plugin_base import CMSPluginBase
from django.utils.translation import ugettext_lazy as _
import models
from django.conf import settings


class FilerTeaserPlugin(CMSPluginBase):
    """
    TODO: this plugin is becoming very similar to the image plugin... code 
          should be re-used somehow.
    """
    model = models.FilerTeaser
    name = _("Teaser")
    render_template = "cmsplugin_filer_teaser/teaser.html"
    
    def _get_thumbnail_options(self, context, instance):
        """
        Return the size and options of the thumbnail that should be inserted
        """
        width, height = None, None
        subject_location = False
        placeholder_width = context.get('width', None)
        placeholder_height = context.get('height', None)
        if instance.use_autoscale and placeholder_width:
            # use the placeholder width as a hint for sizing
            width = int(placeholder_width)
        if instance.use_autoscale and placeholder_height:
            height = int(placeholder_height)
        elif instance.width:
            width = instance.width
        if instance.height:
            height = instance.height
{'fraction_non_alphanumeric': 0.06623655913978495, 'fraction_numerical': 0.0, 'mean_word_length': 2.7097288676236047, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6027161', 'n_tokens_mistral': 603, 'n_tokens_neox': 600, 'n_words': 195}