Re: how to pass a custom object to re.search?

2007-08-17 Thread brunovianarezende
> Try to implement __str__() for your object and provide a string > representation for it. > > re.search(str(custom_object)) > I've done that (and added __unicode__ too). I only didn't want to, I want to do: re.search(custom_object) so, code that worked before as: re.search(parentobj.custom_obj

how to pass a custom object to re.search?

2007-08-17 Thread brunovianarezende
Hi, sorry if this is a faq. I've searched and got no result. I'm willing to pass a custom object to re.search method, but I'm getting the error: TypeError: expected string or buffer I don't want to make my object to inherit from basestring (nor I know how to do it...). Then I was left with 'buff