[Zope-dev] Hookable Parameter Checking

Ivan Raikov ivan@faxnet.com
Mon, 12 Nov 2001 09:18:00 -0500


> Now that's a brilliant idea :-)
> Could you stick that in a Proposal and get it implemented? I'd love to use it...

  Write a proposal -- yes. Get it implemented -- I'll try :-)

> Ah, but surely the hookable method you propose could be used to doing any
> filtering required. This'd be my idea:
>
>  param1 = kw.get('param1','')
>  param1 = coerce(param1,'html',tags=self.allowed_tags)
>  return ((),{'param1':param1})

   Hm, I've never thought of using coerce for that purpose; I've
always thought it's used only for math operations... Anyway, when I
proposed the filter methods, I meant that we can still use the hook
mechanism, but provide a number of pre-defined, stock methods that
people can use (kinda like the __coerce__ methods from your example). 

> I just have a feeling that it might make your app crawl though :-(

  Hey, I never said it'll be fast 8-) But seriously, while I don't
know how fast would Python filtering be, if there are any performance
issues, I think a primitive HTML parser written in C can take care of
most of them.