Esempio n. 1
0
    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
Esempio n. 2
0
 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
Esempio n. 3
0
	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
Esempio n. 4
0
 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