def get_slide_type(cls):

        '''
        Using the instance's name, htmltemplate, jstemplate, gateway, cssfiles,
        jsfiles attributes, get the widget type with those attributes.

        '''

        defaults = collections.Bunch(cls.slide_type_defaults)

        base_name = cls.get_base_name()

        app_label = defaults.app_label or cls._meta.app_label
        name = defaults.name or base_name
        htmltemplate = defaults.htmltemplate or conf.default_experiment_template

        cssfiles = tuple(collections.uniquelist(defaults.cssfiles))
        jsfiles = tuple(collections.uniquelist(defaults.jsfiles))

        return SlideTypes.new(
            name = name,
            app_label = app_label,
            htmltemplate = htmltemplate,
            cssfiles = cssfiles,
            jsfiles = jsfiles
        )
    def get_widget_type(cls):

        '''
        Using the instance's name, htmltemplate, jstemplate, gateway, cssfiles,
        jsfiles attributes, get the widget type with those attributes.

        '''

        defaults = collections.Bunch(cls.widget_type_defaults)

        base_name = cls.get_base_name()

        name = defaults.name or base_name
        app_label = defaults.app_label or cls._meta.app_label
        htmltemplate = defaults.htmltemplate or base_name + conf.htmltemplate_suffix
        jstemplate = defaults.jstemplate or base_name + conf.jstemplate_suffix
        gateway = defaults.gateway or conf.default_widget_gateway

        cssfiles = tuple(collections.uniquelist(defaults.cssfiles))
        jsfiles = tuple(collections.uniquelist(defaults.jsfiles))

        return WidgetTypes.new(
            name = name,
            app_label = app_label,
            htmltemplate = htmltemplate,
            jstemplate = jstemplate,
            gateway = gateway,
            cssfiles = cssfiles,
            jsfiles = jsfiles
        )
Esempio n. 3
0
    def fold(self, wordlist):
        '''
        Words can be forced to be uppercase, lowercase, or capitalized.
        They can also be forced to be a unique list.
        '''

        folded_wordlist = map(self.foldcase_options[self.foldcase], wordlist)

        if self.uniquelist:
            return collections.uniquelist(folded_wordlist)
        else:
            return folded_wordlist