コード例 #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
コード例 #2
0
ファイル: model_fields.py プロジェクト: cilcoberlin/panoptes
 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
コード例 #3
0
ファイル: fields.py プロジェクト: cilcoberlin/panoptes
	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
コード例 #4
0
ファイル: model_fields.py プロジェクト: oberlin/panoptes
 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