def add_defaults(dict): result = dict for parameter in thumbnails_parameters: if not parameter in dict: try: result[parameter] = str(get_thumbnail_setting(parameter)) except: pass return result
def render(self, context): for parameter, value in self.options.items(): try: tmp = template.Variable(value) actual_value = tmp.resolve(context) except template.VariableDoesNotExist: t = type(get_thumbnail_setting(parameter)) actual_value = transform(value, t) self.options[parameter] = actual_value return render_to_string("video/thumbnails.html", self.options)
def get_upload_to(self, attname): tmp = self.video.get_upload_to() thumb_dir = get_thumbnail_setting('dir') return "%s/%s" % (tmp, thumb_dir)