def clean(self, value): """Return a Lens instance if the slug is valid.""" Lens = lens_factory(value) if not Lens: raise forms.ValidationError(_("select a valid view")) return Lens
def _resolve_lens_from_slug(self, slug): """Return the Lens class matching the given slug.""" Lens = lens_factory(slug) if not Lens: raise TypeError( ugettext("Invalid lens for slug %(slug)s") % {'slug': slug}) return Lens
def _resolve_lens_from_slug(self, slug): """Return the Lens class matching the given slug.""" Lens = lens_factory(slug) if not Lens: raise TypeError(ugettext("Invalid lens for slug %(slug)s") % {"slug": slug}) return Lens