def validate(self, default, **optional): if not_unicode_or_ascii(default) and not IIcon.providedBy(default): raise GrokImportError( "The '%s' directive can only be called with " "unicode or ASCII." % self.name) for key, value in optional.items(): if not_unicode_or_ascii(value) and not IIcon.providedBy(default): raise GrokImportError( "The '%s' directive can only be called with " "unicode or ASCII." % self.name)
def validate(self, value): if util.check_subclass(value, components.Permission): return if util.not_unicode_or_ascii(value): raise GrokImportError( "You can only pass unicode, ASCII, or a subclass " "of grok.Permission to the '%s' directive." % self.name)
def validate(self, all=None, **kw): items = list(kw.items()) if all is not None: items += [("all", all)] for action, value in kw.items(): if util.check_subclass(value, components.Permission): continue if util.not_unicode_or_ascii(value): raise GrokImportError( "You can only pass unicode, ASCII, or a subclass " "of grok.Permission to the '%s' directive." % self.name )
def validateText(directive, value): if util.not_unicode_or_ascii(value): raise GrokImportError("The '%s' directive can only be called with " "unicode or ASCII." % directive.name)