Another option I'd consider - using Python's built-in HTMLParser class to
do the work. This would remove the need for any dependencies. The only
problem is that it will choke on bad HTML. In that case I think we can just
handle an exception, and not perform thumbnail generation - TinyMCE and
others should produce valid HTML. Again this would fall under the "slow"
camp that would need to occur on save.


On Tue, Jun 3, 2014 at 5:25 PM, Stephen McDonald <st...@jupo.org> wrote:

> That would be clean but I'm worried about performance. I can't see any
> other way of making this working without introducing lxml or BeautifulSoup
> - either of those will parse the HTML, replacing img src attributes with
> results from the thumbnail template tag (btw I imagined width/height would
> simply be extracted from the img tags too).
>
> As I understand lxml is much better from a performance perspective, and if
> we were using it then perhaps parsing HTML on every request would be OK.
> But it isn't a pure Python lib, and I fear introducing installation
> headaches if we include it as a dependency. Believe me, it will break for
> someone somewhere, and we have to support that. Alternatively we can
> introduce pure-Python BeautifulSoup as the dependency, but it's much slower
> and so it'd make more sense for the thumbnail replacement to occur on save
> of the model, rather than on the fly in templates.
>
>
>
>
>
>
>
>
>
>
> On Tue, Jun 3, 2014 at 3:13 PM, Ahmad Khayyat <akhay...@gmail.com> wrote:
>
>> Now that `RICHTEXT_FILTERS` is plural, perhaps this is simply a matter of
>> shipping a filter in Mezzanine that calls
>> `mezzanine.core.templatetags.mezzanine_tags.thumbnail`, or at least
>> documenting this procedure. The thumbnail size (and any other parameters
>> accepted by `thumbnail`) can be set in a custom filter or as settings.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Mezzanine Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to mezzanine-users+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Stephen McDonald
> http://jupo.org
>



-- 
Stephen McDonald
http://jupo.org

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to