The first argument to Constraint.construct() is a URL helper object which allows you to set the scheme, host, path, querystring and fragment separately. So reversing a domain constraint is as simple as this:
class DomainConstraint(Constraint): ... def construct(self, url_object, *args, **kwargs): url_object.host = self.domain return url_object, args, kwargs On Thursday, January 7, 2016 at 2:07:03 PM UTC+1, Florian Apolloner wrote: > > > > On Monday, December 28, 2015 at 5:23:19 PM UTC+1, Marten Kenbeek wrote: >> >> One can for example implement a DomainConstraint or MethodConstraint to >> match a domain name or request method in the URL, or implement a set of >> constraints based on the parse library for better performance than the >> built-in regex-based constraints. >> > > A method constraint seems simple enough, how would the domain constraint > work with regards to reversing -- do you have an example for that? > > Cheers, > Florian > -- 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 post to this group, send email to firstname.lastname@example.org. Visit this group at https://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/b3cff701-3032-4a8a-8b41-e2123fde21ff%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.