Hi Django.

I'm currently working on a project where we want to use Django template 
filter *urlize*, but with a custom url formatter. The way the Django code 
works atm, we can't extend *urlize* customize output. That means we have to 
go non-DRY and copy code. Generally I like using class based coding for 
this kind of thing, but Djangos template filters seems to prefer functions 
and discourage instantiation. Therefore, it would be nice to solve this in 
a functional style, in line with current design.

Wouldn't it be a good idea to extend django.utils.html.urlize, or am I 
looking at this the wrong way?

The function signature would be smthng like this:

def urlize(
        text,
        trim_url_limit=None,  *# for compat reasons, though it would make 
sense to accomplish that with the formatter functions in 
the urlizetrunc filter.*
        nofollow=False,
        autoescape=False,
        email_formatter: callable = None,
        url_formatter: callable = None,
    ):
    ...


Johan Schiff
Betahaus (SE)

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/5d2877db-83e9-4bda-8087-98f5cd8fc57c%40googlegroups.com.

Reply via email to